1package 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. 7type BasicError struct { 8 Message string 9} 10 11// NewBasicError is used to create a BasicError. 12// 13// err is allowed to be nil. 14func NewBasicError(err error) *BasicError { 15 if err == nil { 16 return nil 17 } 18 19 return &BasicError{err.Error()} 20} 21 22func (e *BasicError) Error() string { 23 return e.Message 24} 25