提交 8ee7aa5c 作者: keks 提交者: Jan Winkelmann

commands: restore and test original error order

License: MIT
Signed-off-by: 's avatarJan Winkelmann <j-winkelmann@tuhh.de>
上级 1c50ec0c
...@@ -17,8 +17,8 @@ type ErrorType uint ...@@ -17,8 +17,8 @@ type ErrorType uint
const ( const (
ErrNormal ErrorType = iota // general errors ErrNormal ErrorType = iota // general errors
ErrClient // error was caused by the client, (e.g. invalid CLI usage) ErrClient // error was caused by the client, (e.g. invalid CLI usage)
ErrNotFound // == HTTP 404 Not Found
ErrImplementation // programmer error in the server ErrImplementation // programmer error in the server
ErrNotFound // == HTTP 404 Not Found
// TODO: add more types of errors for better error-specific handling // TODO: add more types of errors for better error-specific handling
) )
......
...@@ -53,6 +53,12 @@ func TestMarshalling(t *testing.T) { ...@@ -53,6 +53,12 @@ func TestMarshalling(t *testing.T) {
} }
} }
func TestErrTypeOrder(t *testing.T) {
if ErrNormal != 0 || ErrClient != 1 || ErrImplementation != 2 || ErrNotFound != 3 {
t.Fatal("ErrType order is wrong")
}
}
func removeWhitespace(input string) string { func removeWhitespace(input string) string {
input = strings.Replace(input, " ", "", -1) input = strings.Replace(input, " ", "", -1)
input = strings.Replace(input, "\t", "", -1) input = strings.Replace(input, "\t", "", -1)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论