Commit 95b0dd29 authored by Matt Bell's avatar Matt Bell Committed by Juan Batiz-Benet

commands: Added an Error struct for creating marshallable errors

parent d1595ce3
......@@ -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) {
}*/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment