forked from proximax-storage/go-xpx-chain-sdk
/
errors.go
91 lines (77 loc) · 3.1 KB
/
errors.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
86
87
88
89
90
91
// Copyright 2018 ProximaX Limited. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package sdk
import "errors"
type RespErr struct {
msg string
}
func newRespError(msg string) error {
return &RespErr{msg: msg}
}
func (r *RespErr) Error() string {
return r.msg
}
// Catapult REST API errors
var (
ErrResourceNotFound = newRespError("resource is not found")
ErrArgumentNotValid = newRespError("argument is not valid")
ErrInvalidRequest = newRespError("request is not valid")
ErrInternalError = newRespError("response is nil")
ErrNotAcceptedResponseStatusCode = newRespError("not accepted response status code")
)
// Metadata errors
var (
ErrMetadataEmptyAddresses = errors.New("list adresses ids must not by empty")
ErrMetadataNilAdress = errors.New("adress must not be blank")
ErrMetadataEmptyMosaicIds = errors.New("list mosaics ids must not by empty")
ErrMetadataNilMosaicId = errors.New("mosaicId must not be nil")
ErrMetadataEmptyNamespaceIds = errors.New("list namespaces ids must not by empty")
ErrMetadataNilNamespaceId = errors.New("namespaceId must not be nil")
)
// Common errors
var (
ErrNilAssetId = errors.New("AssetId should not be nil")
ErrEmptyAssetIds = errors.New("AssetId's array should not be empty")
ErrUnknownBlockchainType = errors.New("Not supported Blockchain Type")
ErrInvalidHashLength = errors.New("The length of Hash is invalid")
ErrInvalidSignatureLength = errors.New("The length of Signature is invalid")
)
// Mosaic errors
var (
ErrEmptyMosaicIds = errors.New("list mosaics ids must not by empty")
ErrNilMosaicId = errors.New("mosaicId must not be nil")
ErrWrongBitMosaicId = errors.New("mosaicId has 64th bit")
ErrInvalidOwnerPublicKey = errors.New("public owner key is invalid")
ErrNilMosaicProperties = errors.New("mosaic properties must not be nil")
)
// Namespace errors
var (
ErrNamespaceTooManyPart = errors.New("too many parts")
ErrNilNamespaceId = errors.New("namespaceId is nil or zero")
ErrWrongBitNamespaceId = errors.New("namespaceId doesn't have 64th bit")
ErrEmptyNamespaceIds = errors.New("list namespace ids must not by empty")
ErrInvalidNamespaceName = errors.New("namespace name is invalid")
)
// Blockchain errors
var (
ErrNilOrZeroHeight = errors.New("block height should not be nil or zero")
ErrNilOrZeroLimit = errors.New("limit should not be nil or zero")
)
// Lock errors
var (
ErrNilSecret = errors.New("Secret should not be nil")
ErrNilProof = errors.New("Proof should not be nil")
)
// plain errors
var (
ErrEmptyAddressesIds = errors.New("list of addresses should not be empty")
ErrNilAddress = errors.New("address is nil")
ErrBlankAddress = errors.New("address is blank")
ErrNilAccount = errors.New("account should not be nil")
ErrInvalidAddress = errors.New("wrong address")
)
// reputations error
var (
ErrInvalidReputationConfig = errors.New("default reputation should be greater than 0 and less than 1")
)