diff --git a/commands/response.go b/commands/response.go index 6a60f1435..a538814c5 100644 --- a/commands/response.go +++ b/commands/response.go @@ -7,6 +7,12 @@ const ( // TODO: add more types of errors for better error-specific handling ) +// Error is a struct for marshalling errors +type Error struct { + message string + code ErrorType +} + type Response struct { req *Request Error error @@ -19,6 +25,10 @@ func (r *Response) SetError(err error, errType ErrorType) { r.ErrorType = errType } +func (r *Response) FormatError() Error { + return Error{ r.Error.Error(), r.ErrorType } +} + /*func (r *Response) Encode() ([]byte, error) { }*/