diff options
Diffstat (limited to 'vendor/github.com/hashicorp/go-plugin/error.go')
-rw-r--r-- | vendor/github.com/hashicorp/go-plugin/error.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/go-plugin/error.go b/vendor/github.com/hashicorp/go-plugin/error.go new file mode 100644 index 0000000..22a7baa --- /dev/null +++ b/vendor/github.com/hashicorp/go-plugin/error.go | |||
@@ -0,0 +1,24 @@ | |||
1 | package plugin | ||
2 | |||
3 | // This is a type that wraps error types so that they can be messaged | ||
4 | // across RPC channels. Since "error" is an interface, we can't always | ||
5 | // gob-encode the underlying structure. This is a valid error interface | ||
6 | // implementer that we will push across. | ||
7 | type BasicError struct { | ||
8 | Message string | ||
9 | } | ||
10 | |||
11 | // NewBasicError is used to create a BasicError. | ||
12 | // | ||
13 | // err is allowed to be nil. | ||
14 | func NewBasicError(err error) *BasicError { | ||
15 | if err == nil { | ||
16 | return nil | ||
17 | } | ||
18 | |||
19 | return &BasicError{err.Error()} | ||
20 | } | ||
21 | |||
22 | func (e *BasicError) Error() string { | ||
23 | return e.Message | ||
24 | } | ||