mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 01:41:48 -06:00
8d100bfde9
HCL diagnostics relating to expression evaluation include these, so this is really just to pass that information through our Terraform-specific diagnostics interface.
29 lines
550 B
Go
29 lines
550 B
Go
package tfdiags
|
|
|
|
// nativeError is a Diagnostic implementation that wraps a normal Go error
|
|
type nativeError struct {
|
|
err error
|
|
}
|
|
|
|
var _ Diagnostic = nativeError{}
|
|
|
|
func (e nativeError) Severity() Severity {
|
|
return Error
|
|
}
|
|
|
|
func (e nativeError) Description() Description {
|
|
return Description{
|
|
Summary: FormatError(e.err),
|
|
}
|
|
}
|
|
|
|
func (e nativeError) Source() Source {
|
|
// No source information available for a native error
|
|
return Source{}
|
|
}
|
|
|
|
func (e nativeError) FromExpr() *FromExpr {
|
|
// Native errors are not expression-related
|
|
return nil
|
|
}
|