export class ErrAddressMalformed extends Error { constructor(message?: string) { super(message ? message : 'address malformed'); } } export class ErrDstAddressMalformed extends Error { constructor(message?: string) { super(message ? message : 'destination address malformed'); } } export class ErrDstAccountUnknown extends Error { constructor(message?: string) { super(message ? message : 'destination account is unknown'); } } export class ErrAccountNotFound extends Error { constructor(message?: string) { super(message ? message : 'account not found'); } } export class ErrAccountAlreadyExists extends Error { constructor(message?: string) { super(message ? message : 'account already exists'); } } export class ErrOrgNotFound extends Error { constructor(message?: string) { super(message ? message : 'organization not found'); } } export class ErrTransactionNotFound extends Error { constructor(message?: string) { super(message ? message : 'transaction not found'); } } export class ErrBlockNotFound extends Error { constructor(message?: string) { super(message ? message : 'block not found'); } } export class ErrMetadataProvidedButNoURI extends Error { constructor(message?: string) { super(message ? message : 'metadata provided but no metadata URI found in transaction'); } } export class ErrMetadataURINotMatchContent extends Error { constructor(message?: string) { super(message ? message : 'metadata URI does not match metadata content'); } } export class ErrMarshalingJSONFailed extends Error { constructor(message?: string) { super(message ? message : 'marshaling JSON failed'); } } export class ErrFileSizeTooBig extends Error { constructor(message?: string) { super(message ? message : 'file size exceeds the maximum allowed'); } } export class ErrCantParseOrgID extends Error { constructor(message?: string) { super(message ? message : 'cannot parse organizationId'); } } export class ErrCantParseAccountID extends Error { constructor(message?: string) { super(message ? message : 'cannot parse accountId'); } } export class ErrCantParseBearerToken extends Error { constructor(message?: string) { super(message ? message : 'cannot parse bearer token'); } } export class ErrCantParseDataAsJSON extends Error { constructor(message?: string) { super(message ? message : 'cannot parse data as JSON'); } } export class ErrCantParseElectionID extends Error { constructor(message?: string) { super(message ? message : 'cannot parse electionId'); } } export class ErrCantParseMetadataAsJSON extends Error { constructor(message?: string) { super(message ? message : 'cannot parse metadata (invalid format)'); } } export class ErrCantParseNumber extends Error { constructor(message?: string) { super(message ? message : 'cannot parse number'); } } export class ErrCantParsePayloadAsJSON extends Error { constructor(message?: string) { super(message ? message : 'cannot parse payload as JSON'); } } export class ErrCantParseVoteID extends Error { constructor(message?: string) { super(message ? message : 'cannot parse voteId'); } } export class ErrCantExtractMetadataURI extends Error { constructor(message?: string) { super(message ? message : 'cannot extract metadata URI'); } } export class ErrVoteIDMalformed extends Error { constructor(message?: string) { super(message ? message : 'voteId is malformed'); } } export class ErrVoteNotFound extends Error { constructor(message?: string) { super(message ? message : 'vote not found'); } } export class ErrCensusIDLengthInvalid extends Error { constructor(message?: string) { super(message ? message : 'censusId length is wrong'); } } export class ErrCensusRootIsNil extends Error { constructor(message?: string) { super(message ? message : 'census root is nil'); } } export class ErrCensusTypeUnknown extends Error { constructor(message?: string) { super(message ? message : 'census type is unknown'); } } export class ErrCensusTypeMismatch extends Error { constructor(message?: string) { super(message ? message : 'census type mismatch'); } } export class ErrCensusIndexedFlagMismatch extends Error { constructor(message?: string) { super(message ? message : 'census indexed flag mismatch'); } } export class ErrCensusRootHashMismatch extends Error { constructor(message?: string) { super(message ? message : 'census root hash mismatch after importing dump'); } } export class ErrParamStatusInvalid extends Error { constructor(message?: string) { super(message ? message : 'parameter (status) invalid'); } } export class ErrParamParticipantsMissing extends Error { constructor(message?: string) { super(message ? message : 'parameter (participants) missing'); } } export class ErrParamParticipantsTooBig extends Error { constructor(message?: string) { super(message ? message : 'parameter (participants) exceeds max length per call'); } } export class ErrParamDumpOrRootMissing extends Error { constructor(message?: string) { super(message ? message : 'parameter (dump or root) missing'); } } export class ErrParamKeyOrProofMissing extends Error { constructor(message?: string) { super(message ? message : 'parameter (key or proof) missing'); } } export class ErrParamRootInvalid extends Error { constructor(message?: string) { super(message ? message : 'parameter (root) invalid'); } } export class ErrParamNetworkInvalid extends Error { constructor(message?: string) { super(message ? message : 'invalid network'); } } export class ErrParamToInvalid extends Error { constructor(message?: string) { super(message ? message : 'invalid address'); } } export class ErrParticipantKeyMissing extends Error { constructor(message?: string) { super(message ? message : 'missing participant key'); } } export class ErrIndexedCensusCantUseWeight extends Error { constructor(message?: string) { super(message ? message : 'indexed census cannot use weight'); } } export class ErrWalletNotFound extends Error { constructor(message?: string) { super(message ? message : 'wallet not found'); } } export class ErrWalletPrivKeyAlreadyExists extends Error { constructor(message?: string) { super(message ? message : 'wallet private key already exists'); } } export class ErrElectionEndDateInThePast extends Error { constructor(message?: string) { super(message ? message : 'election end date cannot be in the past'); } } export class ErrElectionEndDateBeforeStart extends Error { constructor(message?: string) { super(message ? message : 'election end date must be after start date'); } } export class ErrElectionNotFound extends Error { constructor(message?: string) { super(message ? message : 'election not found'); } } export class ErrCensusNotFound extends Error { constructor(message?: string) { super(message ? message : 'census not found'); } } export class ErrNoElectionKeys extends Error { constructor(message?: string) { super(message ? message : 'no election keys available'); } } export class ErrMissingParameter extends Error { constructor(message?: string) { super(message ? message : 'one or more parameters are missing'); } } export class ErrKeyNotFoundInCensus extends Error { constructor(message?: string) { super(message ? message : 'key not found in census'); } } export class ErrInvalidStatus extends Error { constructor(message?: string) { super(message ? message : 'invalid status'); } } export class ErrInvalidCensusKeyLength extends Error { constructor(message?: string) { super(message ? message : 'invalid census key length'); } } export class ErrUnmarshalingServerProto extends Error { constructor(message?: string) { super(message ? message : 'error unmarshaling protobuf data'); } } export class ErrMarshalingServerProto extends Error { constructor(message?: string) { super(message ? message : 'error marshaling protobuf data'); } } export class ErrSIKNotFound extends Error { constructor(message?: string) { super(message ? message : 'SIK not found'); } } export class ErrCantParseBoolean extends Error { constructor(message?: string) { super(message ? message : 'cannot parse string into boolean'); } } export class ErrCantParseHexString extends Error { constructor(message?: string) { super(message ? message : 'cannot parse string into hex bytes'); } } export class ErrPageNotFound extends Error { constructor(message?: string) { super(message ? message : 'page not found'); } } export class ErrVochainEmptyReply extends Error { constructor(message?: string) { super(message ? message : 'vochain returned an empty reply'); } } export class ErrVochainSendTxFailed extends Error { constructor(message?: string) { super(message ? message : 'vochain SendTx failed'); } } export class ErrVochainGetTxFailed extends Error { constructor(message?: string) { super(message ? message : 'vochain GetTx failed'); } } export class ErrVochainReturnedErrorCode extends Error { constructor(message?: string) { super(message ? message : 'vochain replied with error code'); } } export class ErrVochainReturnedInvalidElectionID extends Error { constructor(message?: string) { super(message ? message : 'vochain returned an invalid electionId after executing tx'); } } export class ErrVochainReturnedWrongMetadataCID extends Error { constructor(message?: string) { super(message ? message : 'vochain returned an unexpected metadata CID after executing tx'); } } export class ErrMarshalingServerJSONFailed extends Error { constructor(message?: string) { super(message ? message : 'marshaling (server-side) JSON failed'); } } export class ErrCantFetchElection extends Error { constructor(message?: string) { super(message ? message : 'cannot fetch election'); } } export class ErrCantFetchTokenTransfers extends Error { constructor(message?: string) { super(message ? message : 'cannot fetch token transfers'); } } export class ErrCantFetchEnvelopeHeight extends Error { constructor(message?: string) { super(message ? message : 'cannot fetch envelope height'); } } export class ErrCantFetchEnvelope extends Error { constructor(message?: string) { super(message ? message : 'cannot fetch vote envelope'); } } export class ErrCantCheckTxType extends Error { constructor(message?: string) { super(message ? message : 'cannot check transaction type'); } } export class ErrCantABIEncodeResults extends Error { constructor(message?: string) { super(message ? message : 'cannot abi.encode results'); } } export class ErrCantComputeKeyHash extends Error { constructor(message?: string) { super(message ? message : 'cannot compute key hash'); } } export class ErrCantAddKeyAndValueToTree extends Error { constructor(message?: string) { super(message ? message : 'cannot add key and value to tree'); } } export class ErrCantAddKeyToTree extends Error { constructor(message?: string) { super(message ? message : 'cannot add key to tree'); } } export class ErrCantGenerateFaucetPkg extends Error { constructor(message?: string) { super(message ? message : 'cannot generate faucet package'); } } export class ErrCantEstimateBlockHeight extends Error { constructor(message?: string) { super(message ? message : 'cannot estimate startDate block height'); } } export class ErrCantMarshalMetadata extends Error { constructor(message?: string) { super(message ? message : 'cannot marshal metadata'); } } export class ErrCantPublishMetadata extends Error { constructor(message?: string) { super(message ? message : 'cannot publish metadata file'); } } export class ErrTxTypeMismatch extends Error { constructor(message?: string) { super(message ? message : 'transaction type mismatch'); } } export class ErrElectionIsNil extends Error { constructor(message?: string) { super(message ? message : 'election is nil'); } } export class ErrElectionResultsNotYetAvailable extends Error { constructor(message?: string) { super(message ? message : 'election results are not yet available'); } } export class ErrElectionResultsIsNil extends Error { constructor(message?: string) { super(message ? message : 'election results is nil'); } } export class ErrElectionResultsMismatch extends Error { constructor(message?: string) { super(message ? message : "election results don't match reported ones"); } } export class ErrCantGetCircomSiblings extends Error { constructor(message?: string) { super(message ? message : 'cannot get circom siblings'); } } export class ErrCensusProofVerificationFailed extends Error { constructor(message?: string) { super(message ? message : 'census proof verification failed'); } } export class ErrCantCountVotes extends Error { constructor(message?: string) { super(message ? message : 'cannot count votes'); } } export class ErrVochainOverloaded extends Error { constructor(message?: string) { super(message ? message : 'vochain overloaded'); } } export class ErrGettingSIK extends Error { constructor(message?: string) { super(message ? message : 'error getting SIK'); } } export class ErrCensusBuild extends Error { constructor(message?: string) { super(message ? message : 'error building census'); } } export class ErrIndexerQueryFailed extends Error { constructor(message?: string) { super(message ? message : 'indexer query failed'); } } export class ErrCantFetchTokenFees extends Error { constructor(message?: string) { super(message ? message : 'cannot fetch token fees'); } } export class ErrFaucetAlreadyFunded extends Error { public untilDate: Date; constructor(message?: string) { super(message ? message : 'address already funded'); if (message) { const date = message.split('wait until '); const [datePart, timePart] = date[date.length - 1].split(' '); const [year, month, day] = datePart.split('-').map(Number); const [hour, minute, second] = timePart.split(':').map(Number); this.untilDate = new Date(Date.UTC(year, month - 1, day, hour, minute, second)); } } } export class ErrElectionNotStarted extends Error { constructor(message?: string) { super(message ? message : 'election not started'); } } export class ErrElectionFinished extends Error { constructor(message?: string) { super(message ? message : 'election finished'); } } export class CensusStillNotPublished extends Error { constructor(message?: string) { super(message ? message : 'census still not published'); } }