mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-27 17:06:27 -06:00
cb2e9119aa
Signed-off-by: namgyalangmo <75657887+namgyalangmo@users.noreply.github.com>
39 lines
816 B
Go
39 lines
816 B
Go
// Copyright (c) The OpenTofu Authors
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
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
|
|
}
|
|
|
|
func (e nativeError) ExtraInfo() interface{} {
|
|
// Native errors don't carry any "extra information".
|
|
return nil
|
|
}
|