forked from DNAProject/DNA
-
Notifications
You must be signed in to change notification settings - Fork 1
/
error.go
85 lines (73 loc) · 3.34 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
* Copyright (C) 2018 The DNA Authors
* This file is part of The DNA library.
*
* The DNA is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The DNA is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with The DNA. If not, see <http://www.gnu.org/licenses/>.
*/
// Package error privides error code for http
package error
import ontErrors "github.com/dnaproject2/DNA/errors"
const (
SUCCESS int64 = 0
SESSION_EXPIRED int64 = 41001
SERVICE_CEILING int64 = 41002
ILLEGAL_DATAFORMAT int64 = 41003
INVALID_VERSION int64 = 41004
INVALID_METHOD int64 = 42001
INVALID_PARAMS int64 = 42002
INVALID_TRANSACTION int64 = 43001
INVALID_ASSET int64 = 43002
INVALID_BLOCK int64 = 43003
UNKNOWN_TRANSACTION int64 = 44001
UNKNOWN_ASSET int64 = 44002
UNKNOWN_BLOCK int64 = 44003
UNKNOWN_CONTRACT int64 = 44004
INTERNAL_ERROR int64 = 45001
SMARTCODE_ERROR int64 = 47001
PRE_EXEC_ERROR int64 = 47002
)
var ErrMap = map[int64]string{
SUCCESS: "SUCCESS",
SESSION_EXPIRED: "SESSION EXPIRED",
SERVICE_CEILING: "SERVICE CEILING",
ILLEGAL_DATAFORMAT: "ILLEGAL DATAFORMAT",
INVALID_VERSION: "INVALID VERSION",
INVALID_METHOD: "INVALID METHOD",
INVALID_PARAMS: "INVALID PARAMS",
INVALID_TRANSACTION: "INVALID TRANSACTION",
INVALID_ASSET: "INVALID ASSET",
INVALID_BLOCK: "INVALID BLOCK",
UNKNOWN_TRANSACTION: "UNKNOWN TRANSACTION",
UNKNOWN_ASSET: "UNKNOWN ASSET",
UNKNOWN_BLOCK: "UNKNOWN BLOCK",
UNKNOWN_CONTRACT: "UNKNOWN CONTRACT",
INTERNAL_ERROR: "INTERNAL ERROR",
SMARTCODE_ERROR: "SMARTCODE EXEC ERROR",
PRE_EXEC_ERROR: "SMARTCODE PREPARE EXEC ERROR",
int64(ontErrors.ErrNoCode): "INTERNAL ERROR, ErrNoCode",
int64(ontErrors.ErrUnknown): "INTERNAL ERROR, ErrUnknown",
int64(ontErrors.ErrDuplicatedTx): "INTERNAL ERROR, ErrDuplicatedTx",
int64(ontErrors.ErrDuplicateInput): "INTERNAL ERROR, ErrDuplicateInput",
int64(ontErrors.ErrAssetPrecision): "INTERNAL ERROR, ErrAssetPrecision",
int64(ontErrors.ErrTransactionBalance): "INTERNAL ERROR, ErrTransactionBalance",
int64(ontErrors.ErrAttributeProgram): "INTERNAL ERROR, ErrAttributeProgram",
int64(ontErrors.ErrTransactionContracts): "INTERNAL ERROR, ErrTransactionContracts",
int64(ontErrors.ErrTransactionPayload): "INTERNAL ERROR, ErrTransactionPayload",
int64(ontErrors.ErrDoubleSpend): "INTERNAL ERROR, ErrDoubleSpend",
int64(ontErrors.ErrTxHashDuplicate): "INTERNAL ERROR, ErrTxHashDuplicate",
int64(ontErrors.ErrStateUpdaterVaild): "INTERNAL ERROR, ErrStateUpdaterVaild",
int64(ontErrors.ErrSummaryAsset): "INTERNAL ERROR, ErrSummaryAsset",
int64(ontErrors.ErrXmitFail): "INTERNAL ERROR, ErrXmitFail",
int64(ontErrors.ErrNoAccount): "INTERNAL ERROR, ErrNoAccount",
}