1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-30 09:59:13 +08:00

commands: restore and test original error order

License: MIT
Signed-off-by: Jan Winkelmann <j-winkelmann@tuhh.de>
This commit is contained in:
keks
2017-04-02 10:57:47 +02:00
committed by Jan Winkelmann
parent 1c50ec0c8e
commit 8ee7aa5cab
2 changed files with 7 additions and 1 deletions

View File

@ -17,8 +17,8 @@ type ErrorType uint
const (
ErrNormal ErrorType = iota // general errors
ErrClient // error was caused by the client, (e.g. invalid CLI usage)
ErrNotFound // == HTTP 404 Not Found
ErrImplementation // programmer error in the server
ErrNotFound // == HTTP 404 Not Found
// TODO: add more types of errors for better error-specific handling
)

View File

@ -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 {
input = strings.Replace(input, " ", "", -1)
input = strings.Replace(input, "\t", "", -1)