1use crate::consensus::signature::SignatureError;
2use crate::consensus::state::data_trigger::DataTriggerError;
3use crate::data_contract::errors::DataContractError;
4
5use crate::errors::consensus::{
6 basic::BasicError, fee::fee_error::FeeError, state::state_error::StateError, ConsensusError,
7};
8
9pub trait ErrorWithCode {
10 fn code(&self) -> u32;
12}
13
14impl ErrorWithCode for ConsensusError {
15 fn code(&self) -> u32 {
16 match self {
17 Self::BasicError(e) => e.code(),
18 Self::SignatureError(e) => e.code(),
19 Self::StateError(e) => e.code(),
20 Self::FeeError(e) => e.code(),
21
22 #[cfg(test)]
23 ConsensusError::TestConsensusError(_) => 1000,
24 ConsensusError::DefaultError => 1, }
26 }
27}
28impl ErrorWithCode for BasicError {
29 fn code(&self) -> u32 {
30 match self {
31 Self::UnsupportedVersionError(_) => 10000,
33 Self::ProtocolVersionParsingError { .. } => 10001,
34 Self::SerializedObjectParsingError { .. } => 10002,
35 Self::UnsupportedProtocolVersionError(_) => 10003,
36 Self::IncompatibleProtocolVersionError(_) => 10004,
37 Self::VersionError(_) => 10005,
38 Self::UnsupportedFeatureError(_) => 10006,
39
40 Self::JsonSchemaCompilationError(..) => 10100,
42 Self::JsonSchemaError(_) => 10101,
43 Self::InvalidIdentifierError { .. } => 10102,
44 Self::ValueError(_) => 10103,
45
46 Self::DataContractMaxDepthExceedError { .. } => 10200,
48 Self::DuplicateIndexError { .. } => 10201,
49 Self::IncompatibleRe2PatternError { .. } => 10202,
50 Self::InvalidCompoundIndexError { .. } => 10203,
51 Self::InvalidDataContractIdError { .. } => 10204,
52 Self::InvalidIndexedPropertyConstraintError { .. } => 10205,
53 Self::InvalidIndexPropertyTypeError { .. } => 10206,
54 Self::InvalidJsonSchemaRefError { .. } => 10207,
55 Self::SystemPropertyIndexAlreadyPresentError { .. } => 10208,
56 Self::UndefinedIndexPropertyError { .. } => 10209,
57 Self::UniqueIndicesLimitReachedError { .. } => 10210,
58 Self::DuplicateIndexNameError { .. } => 10211,
59 Self::InvalidDataContractVersionError { .. } => 10212,
60 Self::IncompatibleDataContractSchemaError { .. } => 10213,
61 Self::ContractError(DataContractError::DocumentTypesAreMissingError { .. }) => 10214,
62 Self::DataContractImmutablePropertiesUpdateError { .. } => 10215,
63 Self::DataContractUniqueIndicesChangedError { .. } => 10216,
64 Self::DataContractInvalidIndexDefinitionUpdateError { .. } => 10217,
65 Self::DataContractHaveNewUniqueIndexError { .. } => 10218,
66 Self::InvalidDocumentTypeRequiredSecurityLevelError { .. } => 10219,
67 Self::UnknownSecurityLevelError { .. } => 10220,
68 Self::UnknownStorageKeyRequirementsError { .. } => 10221,
69 Self::ContractError(DataContractError::DecodingContractError { .. }) => 10222,
70 Self::ContractError(DataContractError::DecodingDocumentError { .. }) => 10223,
71 Self::ContractError(DataContractError::InvalidDocumentTypeError { .. }) => 10224,
72 Self::ContractError(DataContractError::MissingRequiredKey(_)) => 10225,
73 Self::ContractError(DataContractError::FieldRequirementUnmet(_)) => 10226,
74 Self::ContractError(DataContractError::KeyWrongType(_)) => 10227,
75 Self::ContractError(DataContractError::ValueWrongType(_)) => 10228,
76 Self::ContractError(DataContractError::ValueDecodingError(_)) => 10229,
77 Self::ContractError(DataContractError::EncodingDataStructureNotSupported(_)) => 10230,
78 Self::ContractError(DataContractError::InvalidContractStructure(_)) => 10231,
79 Self::ContractError(DataContractError::DocumentTypeNotFound(_)) => 10232,
80 Self::ContractError(DataContractError::DocumentTypeFieldNotFound(_)) => 10233,
81 Self::ContractError(DataContractError::ReferenceDefinitionNotFound(_)) => 10234,
82 Self::ContractError(DataContractError::DocumentOwnerIdMissing(_)) => 10235,
83 Self::ContractError(DataContractError::DocumentIdMissing(_)) => 10236,
84 Self::ContractError(DataContractError::Unsupported(_)) => 10237,
85 Self::ContractError(DataContractError::CorruptedSerialization(_)) => 10238,
86 Self::ContractError(DataContractError::JsonSchema(_)) => 10239,
87 Self::ContractError(DataContractError::InvalidURI(_)) => 10240,
88 Self::ContractError(DataContractError::KeyWrongBounds(_)) => 10241,
89 Self::ContractError(DataContractError::KeyValueMustExist(_)) => 10242,
90 Self::UnknownTransferableTypeError { .. } => 10243,
91 Self::UnknownTradeModeError { .. } => 10244,
92 Self::UnknownDocumentCreationRestrictionModeError { .. } => 10245,
93 Self::IncompatibleDocumentTypeSchemaError { .. } => 10246,
94 Self::ContractError(DataContractError::RegexError(_)) => 10247,
95 Self::ContestedUniqueIndexOnMutableDocumentTypeError(_) => 10248,
96 Self::ContestedUniqueIndexWithUniqueIndexError(_) => 10249,
97 Self::DataContractTokenConfigurationUpdateError { .. } => 10250,
98 Self::InvalidTokenBaseSupplyError(_) => 10251,
99 Self::NonContiguousContractGroupPositionsError(_) => 10252,
100 Self::NonContiguousContractTokenPositionsError(_) => 10253,
101 Self::InvalidTokenDistributionFunctionDivideByZeroError(_) => 10254,
102 Self::InvalidTokenDistributionFunctionInvalidParameterError(_) => 10255,
103 Self::InvalidTokenDistributionFunctionInvalidParameterTupleError(_) => 10256,
104 Self::InvalidTokenDistributionFunctionIncoherenceError(_) => 10257,
105 Self::MissingDefaultLocalizationError(_) => 10258,
106 Self::UnknownGasFeesPaidByError(_) => 10259,
107 Self::UnknownDocumentActionTokenEffectError(_) => 10260,
108 Self::TokenPaymentByBurningOnlyAllowedOnInternalTokenError(_) => 10261,
109 Self::TooManyKeywordsError(_) => 10262,
110 Self::DuplicateKeywordsError(_) => 10263,
111 Self::InvalidDescriptionLengthError(_) => 10264,
112 Self::NewTokensDestinationIdentityOptionRequiredError(_) => 10265,
113 Self::InvalidTokenNameCharacterError(_) => 10266,
114 Self::InvalidTokenNameLengthError(_) => 10267,
115 Self::InvalidTokenLanguageCodeError(_) => 10268,
116 Self::InvalidKeywordCharacterError(_) => 10269,
117 Self::InvalidKeywordLengthError(_) => 10270,
118 Self::DecimalsOverLimitError(_) => 10271,
119 Self::InvalidTokenDistributionBlockIntervalTooShortError(_) => 10272,
120 Self::InvalidTokenDistributionTimeIntervalTooShortError(_) => 10273,
121 Self::InvalidTokenDistributionTimeIntervalNotMinuteAlignedError(_) => 10274,
122 Self::RedundantDocumentPaidForByTokenWithContractId(_) => 10275,
123 Self::DataContractInvalidRequiredFieldsUpdateError { .. } => 10276,
124
125 Self::GroupPositionDoesNotExistError(_) => 10350,
127 Self::GroupActionNotAllowedOnTransitionError(_) => 10351,
128 Self::GroupTotalPowerLessThanRequiredError(_) => 10352,
129 Self::GroupNonUnilateralMemberPowerHasLessThanRequiredPowerError(_) => 10353,
130 Self::GroupExceedsMaxMembersError(_) => 10354,
131 Self::GroupMemberHasPowerOfZeroError(_) => 10355,
132 Self::GroupMemberHasPowerOverLimitError(_) => 10356,
133 Self::MainGroupIsNotDefinedError(_) => 10357,
134 Self::GroupRequiredPowerIsInvalidError(_) => 10358,
135 Self::GroupHasTooFewMembersError(_) => 10359,
136
137 Self::ContractGroupMembershipsOverLimitError(_) => 10360,
139 Self::DuplicateContractGroupMembershipError(_) => 10361,
140 Self::RedundantContractGroupMembershipError(_) => 10362,
141 Self::ContractGroupMemberNotInContractError(_) => 10363,
142 Self::InvalidContractGroupAdminsError(_) => 10364,
143 Self::InvalidContractGroupNameLengthError(_) => 10366,
146 Self::InvalidContractGroupDescriptionLengthError(_) => 10367,
147
148 Self::DataContractNotPresentError { .. } => 10400,
150 Self::DuplicateDocumentTransitionsWithIdsError { .. } => 10401,
151 Self::DuplicateDocumentTransitionsWithIndicesError { .. } => 10402,
152 Self::InconsistentCompoundIndexDataError { .. } => 10403,
153 Self::InvalidDocumentTransitionActionError { .. } => 10404,
154 Self::InvalidDocumentTransitionIdError { .. } => 10405,
155 Self::InvalidDocumentTypeError { .. } => 10406,
156 Self::MissingDataContractIdBasicError { .. } => 10407,
157 Self::MissingDocumentTransitionActionError { .. } => 10408,
158 Self::MissingDocumentTransitionTypeError { .. } => 10409,
159 Self::MissingDocumentTypeError { .. } => 10410,
160 Self::MissingPositionsInDocumentTypePropertiesError { .. } => 10411,
161 Self::MaxDocumentsTransitionsExceededError { .. } => 10412,
162 Self::DocumentTransitionsAreAbsentError { .. } => 10413,
163 Self::NonceOutOfBoundsError(_) => 10414,
164 Self::InvalidDocumentTypeNameError(_) => 10415,
165 Self::DocumentCreationNotAllowedError(_) => 10416,
166 Self::DocumentFieldMaxSizeExceededError(_) => 10417,
167 Self::ContestedDocumentsTemporarilyNotAllowedError(_) => 10418,
168
169 Self::InvalidTokenIdError(_) => 10450,
171 Self::InvalidTokenPositionError(_) => 10451,
172 Self::InvalidActionIdError(_) => 10452,
173 Self::ContractHasNoTokensError(_) => 10453,
174 Self::DestinationIdentityForTokenMintingNotSetError(_) => 10454,
175 Self::ChoosingTokenMintRecipientNotAllowedError(_) => 10455,
176 Self::TokenTransferToOurselfError(_) => 10456,
177 Self::InvalidTokenConfigUpdateNoChangeError(_) => 10457,
178 Self::InvalidTokenAmountError(_) => 10458,
179 Self::InvalidTokenNoteTooBigError(_) => 10459,
180 Self::TokenNoteOnlyAllowedWhenProposerError(_) => 10460,
181 Self::TokenPricingScheduleEmptyError(_) => 10461,
182
183 Self::DuplicatedIdentityPublicKeyBasicError(_) => 10500,
185 Self::DuplicatedIdentityPublicKeyIdBasicError(_) => 10501,
186 Self::IdentityAssetLockProofLockedTransactionMismatchError(_) => 10502,
187 Self::IdentityAssetLockTransactionIsNotFoundError(_) => 10503,
188 Self::IdentityAssetLockTransactionOutPointAlreadyConsumedError(_) => 10504,
189 Self::IdentityAssetLockTransactionOutputNotFoundError(_) => 10505,
190 Self::InvalidAssetLockProofCoreChainHeightError(_) => 10506,
191 Self::InvalidAssetLockProofTransactionHeightError(_) => 10507,
192 Self::InvalidAssetLockTransactionOutputReturnSizeError(_) => 10508,
193 Self::InvalidIdentityAssetLockTransactionError(_) => 10509,
194 Self::InvalidIdentityAssetLockTransactionOutputError(_) => 10510,
195 Self::InvalidIdentityPublicKeyDataError(_) => 10511,
196 Self::InvalidInstantAssetLockProofError(_) => 10512,
197 Self::InvalidInstantAssetLockProofSignatureError(_) => 10513,
198 Self::InvalidIdentityAssetLockProofChainLockValidationError(_) => 10514,
199 Self::DataContractBoundsNotPresentError(_) => 10515,
200 Self::DisablingKeyIdAlsoBeingAddedInSameTransitionError(_) => 10516,
201 Self::MissingMasterPublicKeyError(_) => 10517,
202 Self::TooManyMasterPublicKeyError(_) => 10518,
203 Self::InvalidIdentityPublicKeySecurityLevelError(_) => 10519,
204 Self::InvalidIdentityKeySignatureError { .. } => 10520,
205 Self::InvalidCreditWithdrawalTransitionOutputScriptError(_) => 10521,
206 Self::InvalidCreditWithdrawalTransitionCoreFeeError(_) => 10522,
207 Self::NotImplementedCreditWithdrawalTransitionPoolingError(_) => 10523,
208 Self::InvalidIdentityCreditTransferAmountError(_) => 10524,
209 Self::InvalidIdentityCreditWithdrawalTransitionAmountError(_) => 10525,
210 Self::InvalidIdentityUpdateTransitionEmptyError(_) => 10526,
211 Self::InvalidIdentityUpdateTransitionDisableKeysError(_) => 10527,
212 Self::IdentityCreditTransferToSelfError(_) => 10528,
213 Self::MasterPublicKeyUpdateError(_) => 10529,
214 Self::IdentityAssetLockTransactionOutPointNotEnoughBalanceError(_) => 10530,
215 Self::IdentityAssetLockStateTransitionReplayError(_) => 10531,
216 Self::WithdrawalOutputScriptNotAllowedWhenSigningWithOwnerKeyError(_) => 10532,
217 Self::InvalidKeyPurposeForContractBoundsError(_) => 10533,
218 Self::IdentityAssetLockTransactionTooManyInputsError(_) => 10534,
219 Self::ContractGroupBoundKeyNotAllowedInShieldedIdentityCreationError(_) => 10535,
220 Self::IdentityPublicKeyLimitsNotAllowedError(_) => 10536,
221 Self::InvalidIdentityPublicKeyBudgetError(_) => 10537,
222 Self::IdentityPublicKeyLimitsNotAllowedInShieldedIdentityCreationError(_) => 10538,
223 Self::IdentityKeyLimitsUpdateEmptyError(_) => 10539,
224
225 Self::InvalidStateTransitionTypeError { .. } => 10600,
227 Self::MissingStateTransitionTypeError { .. } => 10601,
228 Self::StateTransitionMaxSizeExceededError { .. } => 10602,
229 Self::StateTransitionNotActiveError(_) => 10603,
230
231 Self::OverflowError(_) => 10700,
233
234 Self::TransitionOverMaxInputsError(_) => 10800,
236 Self::TransitionOverMaxOutputsError(_) => 10801,
237 Self::InputWitnessCountMismatchError(_) => 10802,
238 Self::TransitionNoInputsError(_) => 10803,
239 Self::TransitionNoOutputsError(_) => 10804,
240 Self::FeeStrategyEmptyError(_) => 10805,
241 Self::FeeStrategyDuplicateError(_) => 10806,
242 Self::FeeStrategyIndexOutOfBoundsError(_) => 10807,
243 Self::FeeStrategyTooManyStepsError(_) => 10808,
244 Self::InputBelowMinimumError(_) => 10809,
245 Self::OutputBelowMinimumError(_) => 10810,
246 Self::InputOutputBalanceMismatchError(_) => 10811,
247 Self::OutputsNotGreaterThanInputsError(_) => 10812,
248 Self::WithdrawalBalanceMismatchError(_) => 10813,
249 Self::InsufficientFundingAmountError(_) => 10814,
250 Self::InputsNotLessThanOutputsError(_) => 10815,
251 Self::OutputAddressAlsoInputError(_) => 10816,
252 Self::InvalidRemainderOutputCountError(_) => 10817,
253 Self::WithdrawalBelowMinAmountError(_) => 10818,
254 Self::ShieldedNoActionsError(_) => 10819,
256 Self::ShieldedEmptyProofError(_) => 10820,
257 Self::ShieldedZeroAnchorError(_) => 10821,
258 Self::ShieldedInvalidValueBalanceError(_) => 10822,
259 Self::ShieldedEncryptedNoteSizeMismatchError(_) => 10823,
260 Self::ShieldedTooManyActionsError(_) => 10825,
261 Self::ShieldedImplicitFeeCapExceededError(_) => 10826,
262 Self::ShieldedInvalidDenominationError(_) => 10827,
263 Self::InvalidTokenDistributionEpochIntervalTooShortError(_) => 10828,
264 }
265 }
266}
267
268impl ErrorWithCode for SignatureError {
269 fn code(&self) -> u32 {
270 match self {
271 Self::IdentityNotFoundError { .. } => 20000,
272 Self::InvalidIdentityPublicKeyTypeError { .. } => 20001,
273 Self::InvalidStateTransitionSignatureError { .. } => 20002,
274 Self::MissingPublicKeyError { .. } => 20003,
275 Self::InvalidSignaturePublicKeySecurityLevelError { .. } => 20004,
276 Self::WrongPublicKeyPurposeError { .. } => 20005,
277 Self::PublicKeyIsDisabledError { .. } => 20006,
278 Self::PublicKeySecurityLevelNotMetError { .. } => 20007,
279 Self::SignatureShouldNotBePresentError(_) => 20008,
280 Self::BasicECDSAError(_) => 20009,
281 Self::BasicBLSError(_) => 20010,
282 Self::InvalidSignaturePublicKeyPurposeError(_) => 20011,
283 Self::UncompressedPublicKeyNotAllowedError(_) => 20012,
284 Self::ContractBoundedKeyOutOfBoundsError(_) => 20014,
285 Self::ContractBoundedKeyNonBatchError(_) => 20013,
286 Self::PublicKeyBudgetExhaustedError(_) => 20015,
287 Self::PublicKeyExpiredError(_) => 20016,
288 Self::PublicKeyWithLimitsCannotUpdateKeyLimitsError(_) => 20017,
289 }
290 }
291}
292
293impl ErrorWithCode for FeeError {
294 fn code(&self) -> u32 {
295 match self {
296 Self::BalanceIsNotEnoughError { .. } => 30000,
297 }
298 }
299}
300
301impl ErrorWithCode for StateError {
302 fn code(&self) -> u32 {
303 match self {
304 Self::DataContractAlreadyPresentError { .. } => 40000,
306 Self::DataContractIsReadonlyError { .. } => 40001,
307 Self::DataContractConfigUpdateError { .. } => 40002,
308 Self::DataContractUpdatePermissionError(_) => 40003,
309 Self::DataContractUpdateActionNotAllowedError(_) => 40004,
310 Self::PreProgrammedDistributionTimestampInPastError(_) => 40005,
311 Self::IdentityInTokenConfigurationNotFoundError(_) => 40006,
312 Self::IdentityMemberOfGroupNotFoundError(_) => 40007,
313 Self::DataContractNotFoundError(_) => 40008,
314 Self::InvalidTokenPositionStateError(_) => 40009,
315
316 Self::DocumentAlreadyPresentError { .. } => 40100,
318 Self::DocumentNotFoundError { .. } => 40101,
319 Self::DocumentOwnerIdMismatchError { .. } => 40102,
320 Self::DocumentTimestampsMismatchError { .. } => 40103,
321 Self::DocumentTimestampWindowViolationError { .. } => 40104,
322 Self::DuplicateUniqueIndexError { .. } => 40105,
323 Self::InvalidDocumentRevisionError { .. } => 40106,
324 Self::DocumentTimestampsAreEqualError(_) => 40107,
325 Self::DocumentNotForSaleError(_) => 40108,
326 Self::DocumentIncorrectPurchasePriceError(_) => 40109,
327 Self::DocumentContestCurrentlyLockedError(_) => 40110,
328 Self::DocumentContestNotJoinableError(_) => 40111,
329 Self::DocumentContestIdentityAlreadyContestantError(_) => 40112,
330 Self::DocumentContestDocumentWithSameIdAlreadyPresentError(_) => 40113,
331 Self::DocumentContestNotPaidForError(_) => 40114,
332 Self::RequiredTokenPaymentInfoNotSetError(_) => 40115,
333 Self::IdentityHasNotAgreedToPayRequiredTokenAmountError(_) => 40116,
334 Self::IdentityTryingToPayWithWrongTokenError(_) => 40117,
335 Self::DocumentContestIndexMismatchError(_) => 40118,
336 Self::DocumentContestNotRequiredError(_) => 40119,
337 Self::ReferencedEntityNotFoundError(_) => 40120,
338 Self::ReferencedDocumentTypeNotFoundError(_) => 40121,
339 Self::ReferencedDocumentTypeDeletableError(_) => 40122,
340 Self::ReferencedIdentityKeyNotFoundError(_) => 40123,
341 Self::ReferencedIdentityKeyDisabledError(_) => 40124,
342 Self::ReferencedKeyIdPropertyInvalidError(_) => 40125,
343 Self::ReferencedDocumentPropertyAgreementInvalidError(_) => 40126,
344 Self::ReferencedDocumentPropertyMismatchError(_) => 40127,
345
346 Self::IdentityAlreadyExistsError(_) => 40200,
348 Self::IdentityPublicKeyIsReadOnlyError { .. } => 40201,
349 Self::InvalidIdentityPublicKeyIdError { .. } => 40202,
350 Self::InvalidIdentityRevisionError { .. } => 40203,
351 Self::InvalidIdentityNonceError(_) => 40204,
352 Self::MaxIdentityPublicKeyLimitReachedError { .. } => 40205,
353 Self::DuplicatedIdentityPublicKeyStateError { .. } => 40206,
354 Self::DuplicatedIdentityPublicKeyIdStateError { .. } => 40207,
355 Self::IdentityPublicKeyIsDisabledError { .. } => 40208,
356 Self::MissingIdentityPublicKeyIdsError { .. } => 40209,
357 Self::IdentityInsufficientBalanceError(_) => 40210,
358 Self::IdentityPublicKeyAlreadyExistsForUniqueContractBoundsError(_) => 40211,
359 Self::DocumentTypeUpdateError(_) => 40212,
360 Self::MissingTransferKeyError(_) => 40214,
361 Self::NoTransferKeyForCoreWithdrawalAvailableError(_) => 40215,
362 Self::RecipientIdentityDoesNotExistError(_) => 40216,
363 Self::IdentityToFreezeDoesNotExistError(_) => 40217,
364 Self::IdentityPublicKeyBudgetExceededError(_) => 40218,
365 Self::IdentityPublicKeyAlreadyExpiredError(_) => 40219,
366 Self::IdentityPublicKeyLimitNotSetError(_) => 40220,
367 Self::IdentityPublicKeyLimitNotRaisedError(_) => 40221,
368
369 Self::MasternodeNotFoundError(_) => 40300,
371 Self::VotePollNotFoundError(_) => 40301,
372 Self::VotePollNotAvailableForVotingError(_) => 40302,
373 Self::MasternodeVotedTooManyTimesError(_) => 40303,
374 Self::MasternodeVoteAlreadyPresentError(_) => 40304,
375 Self::MasternodeIncorrectVotingAddressError(_) => 40305,
376 Self::MasternodeIncorrectVoterIdentityIdError(_) => 40306,
377
378 Self::PrefundedSpecializedBalanceInsufficientError(_) => 40400,
380 Self::PrefundedSpecializedBalanceNotFoundError(_) => 40401,
381
382 Self::DataTriggerError(ref e) => e.code(),
384
385 Self::AddressDoesNotExistError(_) => 40600,
387 Self::AddressNotEnoughFundsError(_) => 40601,
388 Self::AddressesNotEnoughFundsError(_) => 40602,
389 Self::AddressInvalidNonceError(_) => 40603,
390
391 Self::IdentityDoesNotHaveEnoughTokenBalanceError(_) => 40700,
393 Self::UnauthorizedTokenActionError(_) => 40701,
394 Self::IdentityTokenAccountFrozenError(_) => 40702,
395 Self::IdentityTokenAccountNotFrozenError(_) => 40703,
396 Self::TokenSettingMaxSupplyToLessThanCurrentSupplyError(_) => 40704,
397 Self::TokenMintPastMaxSupplyError(_) => 40705,
398 Self::NewTokensDestinationIdentityDoesNotExistError(_) => 40706,
399 Self::NewAuthorizedActionTakerIdentityDoesNotExistError(_) => 40707,
400 Self::NewAuthorizedActionTakerGroupDoesNotExistError(_) => 40708,
401 Self::NewAuthorizedActionTakerMainGroupNotSetError(_) => 40709,
402 Self::InvalidGroupPositionError(_) => 40710,
403 Self::TokenIsPausedError(_) => 40711,
404 Self::IdentityTokenAccountAlreadyFrozenError(_) => 40712,
405 Self::TokenAlreadyPausedError(_) => 40713,
406 Self::TokenNotPausedError(_) => 40714,
407 Self::InvalidTokenClaimPropertyMismatch(_) => 40715,
408 Self::InvalidTokenClaimNoCurrentRewards(_) => 40716,
409 Self::InvalidTokenClaimWrongClaimant(_) => 40717,
410 Self::TokenTransferRecipientIdentityNotExistError(_) => 40718,
411 Self::TokenDirectPurchaseUserPriceTooLow(_) => 40719,
412 Self::TokenAmountUnderMinimumSaleAmount(_) => 40720,
413 Self::TokenNotForDirectSale(_) => 40721,
414
415 Self::IdentityNotMemberOfGroupError(_) => 40800,
417 Self::GroupActionDoesNotExistError(_) => 40801,
418 Self::GroupActionAlreadyCompletedError(_) => 40802,
419 Self::GroupActionAlreadySignedByIdentityError(_) => 40803,
420 Self::ModificationOfGroupActionMainParametersNotPermittedError(_) => 40804,
421
422 Self::InvalidAnchorError(_) => 40900,
424 Self::NullifierAlreadySpentError(_) => 40901,
425 Self::InvalidShieldedProofError(_) => 40902,
426 Self::InsufficientPoolNotesError(_) => 40903,
427 Self::InsufficientShieldedFeeError(_) => 40904,
428
429 Self::ContractGroupAlreadyExistsError(_) => 41000,
431 Self::ContractGroupNotFoundError(_) => 41001,
432 Self::IdentityNotContractGroupOwnerOrAdminError(_) => 41002,
433 Self::ContractGroupAdminNotFoundError(_) => 41003,
434 }
435 }
436}
437
438impl ErrorWithCode for DataTriggerError {
439 fn code(&self) -> u32 {
440 match self {
441 Self::DataTriggerConditionError { .. } => 40500,
442 Self::DataTriggerExecutionError { .. } => 40501,
443 Self::DataTriggerInvalidResultError { .. } => 40502,
444 }
445 }
446}