2022-04-03 04:07:16 +00:00
|
|
|
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),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-06 14:21:18 +00:00
|
|
|
func FromError(err error) Diagnostic {
|
|
|
|
return &nativeError{
|
|
|
|
err: err,
|
|
|
|
}
|
2022-04-03 04:07:16 +00:00
|
|
|
}
|