github.com/jbronn/packer@v0.1.6-0.20140120165540-8a1364dbd817/packer/rpc/error.go (about)

     1  package rpc
     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  func NewBasicError(err error) *BasicError {
    12  	return &BasicError{err.Error()}
    13  }
    14  
    15  func (e *BasicError) Error() string {
    16  	return e.Message
    17  }