response.go 486 Bytes
Newer Older
Matt Bell's avatar
Matt Bell committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
package commands

type ErrorType uint
const (
  Normal ErrorType = iota // general errors
  Client // error was caused by the client, (e.g. invalid CLI usage)
  // TODO: add more types of errors for better error-specific handling
)

type Response struct {
  req *Request
  Error error
  ErrorType ErrorType
  Value interface{}
}

func (r *Response) SetError(err error, errType ErrorType) {
  r.Error = err
  r.ErrorType = errType
}

/*func (r *Response) Encode() ([]byte, error) {

}*/