This repository has been archived by the owner on Jun 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
error.go
57 lines (45 loc) · 1.67 KB
/
error.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// NewError - create an error
func NewError(code sdk.CodeType, msg string) sdk.Error {
return sdk.NewError(LinoErrorCodeSpace, code, msg)
}
// ErrInvalidCoins - error if convert LNO to Coin failed
func ErrInvalidCoins(msg string) sdk.Error {
return NewError(CodeInvalidCoins, msg)
}
// ErrAmountOverflow - error if coin amount int64 overflow
func ErrAmountOverflow() sdk.Error {
return NewError(CodeInvalidInt64Number, "coin amount can't be represented as an int64")
}
// ErrInvalidQueryPath - error if query path length is incorrect or content is invalid
func ErrInvalidQueryPath() sdk.Error {
return NewError(CodeInvalidQueryPath, "query path is invalid")
}
// ErrQueryFailed - error if query path length is incorrect or content is invalid
func ErrQueryFailed(reason string) sdk.Error {
return NewError(CodeQueryFailed, "query failed: "+reason)
}
// ErrInvalidIDAAmount - error if the IDA amount is invalid.
func ErrInvalidIDAAmount() sdk.Error {
return NewError(CodeInvalidIDAAmount, "Invalid IDA amount")
}
// ErrUnimplemented - error if the feature is not implemented yet.
func ErrUnimplemented(msg string) sdk.Error {
return NewError(CodeUnimplementedError, msg)
}
// ErrInvalidUsername - error if the username is invalid.
func ErrInvalidUsername(username AccountKey) sdk.Error {
return NewError(CodeInvalidUsername, fmt.Sprintf("Invalid username: %s", username))
}
// ErrUnknownEvent - unknown event.
func ErrUnknownEvent() sdk.Error {
return NewError(CodeUnknownEvent, "unknown event")
}
// ErrTestOnlyDummyError -
func ErrTestDummyError() sdk.Error {
return NewError(CodeTestDummyError, fmt.Sprintf(""))
}