commands: restore and test original error order
License: MIT Signed-off-by: Jan Winkelmann <j-winkelmann@tuhh.de>
keks committed
Apr 2, 2017 at 10:57 UTC
8ee7aa5cabc15f7d19eea9537307029d247eb92c
2 files changed
+7
-1
commands/response.go
+1
-1
@@ -17,8 +17,8 @@ type ErrorType uint
17
const (
18
ErrNormal ErrorType = iota // general errors
19
ErrClient // error was caused by the client, (e.g. invalid CLI usage)
20
- ErrNotFound // == HTTP 404 Not Found
20
ErrImplementation // programmer error in the server
21
+ ErrNotFound // == HTTP 404 Not Found
22
// TODO: add more types of errors for better error-specific handling
23
)
24
commands/response_test.go
+6
@@ -53,6 +53,12 @@ func TestMarshalling(t *testing.T) {
53
}
54
}
55
56
+func TestErrTypeOrder(t *testing.T) {
57
+ if ErrNormal != 0 || ErrClient != 1 || ErrImplementation != 2 || ErrNotFound != 3 {
58
+ t.Fatal("ErrType order is wrong")
59
+ }
60
+}
61
+
62
func removeWhitespace(input string) string {
63
input = strings.Replace(input, " ", "", -1)
64
input = strings.Replace(input, "\t", "", -1)