commands: Added Response
Matt Bell committed
Oct 10, 2014 at 12:36 UTC
f31fd53df9731e14b31c6986ef074ad94ee3bba1
1 file changed
+24
commands/response.go
new
+24
@@ -0,0 +1,24 @@
1
+package commands
2
+
3
+type ErrorType uint
4
+const (
5
+ Normal ErrorType = iota // general errors
6
+ Client // error was caused by the client, (e.g. invalid CLI usage)
7
+ // TODO: add more types of errors for better error-specific handling
8
+)
9
+
10
+type Response struct {
11
+ req *Request
12
+ Error error
13
+ ErrorType ErrorType
14
+ Value interface{}
15
+}
16
+
17
+func (r *Response) SetError(err error, errType ErrorType) {
18
+ r.Error = err
19
+ r.ErrorType = errType
20
+}
21
+
22
+/*func (r *Response) Encode() ([]byte, error) {
23
+
24
+}*/