-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy patherrors.go
More file actions
174 lines (145 loc) · 7.26 KB
/
Copy patherrors.go
File metadata and controls
174 lines (145 loc) · 7.26 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
package hiero
// SPDX-License-Identifier: Apache-2.0
import (
"errors"
"fmt"
// "reflect"
"google.golang.org/grpc/codes"
)
type ErrMaxChunksExceeded struct {
Chunks uint64
MaxChunks uint64
}
var errTransactionIsFrozen = errors.New("transaction is immutable; it has at least one signature or has been explicitly frozen")
var errNoClientOrTransactionID = errors.New("`client` must have an `_Operator` or `transactionId` must be set")
var errNoClientOrTransactionIDOrNodeId = errors.New("`client` must be provided or both `nodeId` and `transactionId` must be set") // nolint
var errClientOperatorSigning = errors.New("`client` must have an `_Operator` to sign with the _Operator")
var errNoClientProvided = errors.New("`client` must be provided and have an _Operator")
var errTransactionIsNotFrozen = errors.New("transaction is not frozen")
var errInnerTransactionShouldBeFrozen = errors.New("inner transaction should be frozen")
var errFailedToDeserializeBytes = errors.New("failed to deserialize bytes")
var errNoTransactionInBytes = errors.New("no transaction was found in bytes")
var errTransactionRequiresSingleNodeAccountID = errors.New("`PrivateKey.SignTransaction()` requires `Transaction` to have a single _Node `AccountID` set")
var errNoTransactions = errors.New("no transactions to execute")
var errByteArrayNull = errors.New("byte array can't be null")
var errParameterNull = errors.New("the parameter can't be null")
var errNetworkNameMissing = errors.New("can't derive checksum for ID without knowing which _Network the ID is for")
var errChecksumMissing = errors.New("no checksum provided")
var errLockedSlice = errors.New("slice is locked")
var errBatchedAndNotBatchTransaction = errors.New("cannot execute batchified transaction outside of BatchTransaction")
var errNodeIsUnhealthy = errors.New("node is unhealthy")
var errNodeIdIsRequired = errors.New("nodeID is required")
var errEvmAddressIsNotALongZeroAddress = errors.New("EVM address is not a correct long zero address")
var errEvmAddressIsNotCorrectSize = errors.New("EVM address is not the correct size")
var errInvalidChunkSize = errors.New("chunk size must be greater than 0")
var errPublicKeyHasNotSigned = errors.New("the public key has not signed this transaction")
// FileUpdateTransaction auto-chunking (ExecuteAll) errors
var errFileUpdateChunkingRequiresFileID = errors.New("FileUpdateTransaction requires a FileID to update contents larger than the chunk size")
var errFileUpdateChunkingRequiresUnfrozen = errors.New("FileUpdateTransaction with contents larger than the chunk size must not be frozen before ExecuteAll")
// Endpoint validation errors
var errEndpointMustHaveAddressOrDomainName = errors.New("endpoint must have either address or domain name")
var errEndpointCannotHaveBothAddressAndDomainName = errors.New("endpoint must have either address or domain name, but not both")
// Node create transaction validation errors
var errTooManyGossipEndpoints = errors.New("gossip endpoints must not contain more than 10 entries")
var errTooManyServiceEndpoints = errors.New("service endpoints must not contain more than 8 entries")
var errGossipCaCertificateEmpty = errors.New("gossip ca certificate must not be empty")
var errDescriptionTooLong = errors.New("description must be less than 100 characters")
// Batch transaction specific errors
var errInnerTransactionNil = errors.New("inner transaction cannot be nil")
var errTransactionTypeNotAllowed = errors.New("transaction type is not allowed in a batch transaction")
var errBatchKeyNotSet = errors.New("batch key needs to be set")
type ErrInvalidNodeAccountIDSet struct {
NodeAccountID AccountID
}
func (err ErrInvalidNodeAccountIDSet) Error() string {
return fmt.Sprintf("Invalid node AccountID was set for transaction: %v", err.NodeAccountID.String())
}
func (err ErrMaxChunksExceeded) Error() string {
return fmt.Sprintf("Message requires %d chunks, but max chunks is %d", err.Chunks, err.MaxChunks)
}
// ErrMaxQueryPaymentExceeded is returned during query execution if the total cost of the query + estimated fees exceeds
// the max query payment threshold set on the client or QueryBuilder.
type ErrMaxQueryPaymentExceeded struct {
// The cost of the query that was attempted as returned by QueryBuilder.GetCost
QueryCost Hbar
// The limit for a single automatic query payment, set by
// Client.SetMaxQueryPayment(int64) or QueryBuilder.SetMaxQueryPayment(uint64).
MaxQueryPayment Hbar
// Name of the query transaction class used for output
query string
}
// Error() implements the Error interface
func (e ErrMaxQueryPaymentExceeded) Error() string {
return fmt.Sprintf("cost of %s (%s) without explicit payment is greater than the max query payment of %s",
e.query,
e.QueryCost.String(),
e.MaxQueryPayment.String())
}
// ErrBadKey is returned if a key is provided in an invalid format or structure
type ErrBadKey struct {
message string
}
func _NewErrBadKeyf(format string, a ...interface{}) ErrBadKey {
return ErrBadKey{fmt.Sprintf(format, a...)}
}
// Error() implements the Error interface
func (e ErrBadKey) Error() string {
return e.message
}
// ErrHederaNetwork is returned in cases where the Hiero _Network cannot be reached or a _Network-side error occurs.
type ErrHederaNetwork struct {
error error
// GRPC Status Code
StatusCode *codes.Code
}
// Error() implements the Error interface
func (e ErrHederaNetwork) Error() string {
return fmt.Sprintf("transport error occurred while accessing the Hiero _Network: %s", e.error)
}
// ErrHederaPreCheckStatus is returned by Transaction.Execute and QueryBuilder.Execute if an exceptional status is
// returned during _Network side validation of the sent transaction.
type ErrHederaPreCheckStatus struct {
TxID TransactionID
Status Status
}
// Error() implements the Error interface
func (e ErrHederaPreCheckStatus) Error() string {
if e.TxID.AccountID == nil {
return fmt.Sprintf("exceptional precheck status %s", e.Status.String())
}
if e.TxID.AccountID._IsZero() {
return fmt.Sprintf("exceptional precheck status %s", e.Status.String())
}
return fmt.Sprintf("exceptional precheck status %s received for transaction %v", e.Status.String(), e.TxID)
}
// ErrHederaReceiptStatus is returned by TransactionID.GetReceipt if the status of the receipt is exceptional.
type ErrHederaReceiptStatus struct {
TxID TransactionID
Status Status
Receipt TransactionReceipt
}
func _NewErrHederaReceiptStatus(id TransactionID, status Status) ErrHederaReceiptStatus {
return ErrHederaReceiptStatus{TxID: id, Status: status}
}
// Error() implements the Error interface
func (e ErrHederaReceiptStatus) Error() string {
return fmt.Sprintf("exceptional receipt status: %s", e.Status.String())
}
// ErrHederaRecordStatus is returned by TransactionID.GetRecord if the status of the record is exceptional.
type ErrHederaRecordStatus struct {
TxID TransactionID
Status Status
}
// Error() implements the Error interface
func (e ErrHederaRecordStatus) Error() string {
return fmt.Sprintf("exceptional precheck status %s", e.Status.String())
}
// ErrLocalValidation is returned by TransactionBuilder.Build(*Client) and QueryBuilder.Execute(*Client)
// if the constructed transaction or query fails local sanity checks.
type ErrLocalValidation struct {
message string
}
// Error() implements the Error interface
func (e ErrLocalValidation) Error() string {
return e.message
}