This repository has been archived by the owner on Oct 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: return explicit execute errors
- Loading branch information
1 parent
8f56304
commit 8dd615a
Showing
3 changed files
with
123 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,39 @@ | ||
export enum PROVIDER_ERRORS { | ||
INVALID_ENDPOINT = 'Provider // Invalid endpoint!', | ||
export enum QUEUE_ERRORS { | ||
JOB_NOT_FOUND = 'Queue // A job with the provided id could not be found!', | ||
REDIS_NOT_AVAILABLE = 'Queue // Could not connect to Redis!', | ||
} | ||
|
||
export enum CONTRACT_ERRORS { | ||
INVALID_CONTRACT = 'Contract // Invalid contract!', | ||
export enum ExecuteProcessorError { | ||
PROVIDER_INVALID_ENDPOINT = 'PROVIDER_INVALID_ENDPOINT', | ||
CONTRACT_INVALID_ADDRESS = 'CONTRACT_INVALID_ADDRESS', | ||
CONTRACT_INVALID_NO_CODE = 'CONTRACT_INVALID_NO_CODE', | ||
WALLET_INVALID_PRIVATE_KEY = 'WALLET_INVALID_PRIVATE_KEY', | ||
CERTIFICATE_NOT_FOUND = 'CERTIFICATE_NOT_FOUND', | ||
EXECUTE_TRANSACTION_FAILED_INIT = 'EXECUTE_TRANSACTION_FAILED_INIT', | ||
EXECUTE_TRANSACTION_REVERT = 'EXECUTE_TRANSACTION_REVERT', | ||
} | ||
|
||
export enum WALLET_ERRORS { | ||
INVALID_PRIVATE_KEY = 'Wallet // Invalid private key!', | ||
export enum ExecuteProcessorErrorMessage { | ||
PROVIDER_INVALID_ENDPOINT = 'Invalid subnet endpoint', | ||
CONTRACT_INVALID_ADDRESS = 'Invalid messaging contract address', | ||
CONTRACT_INVALID_NO_CODE = 'Invalid messaging contract (no code at address)', | ||
WALLET_INVALID_PRIVATE_KEY = 'Invalid private key', | ||
CERTIFICATE_NOT_FOUND = 'A certificate with the provided receipt trie root could not be found', | ||
EXECUTE_TRANSACTION_FAILED_INIT = 'The execute transaction could not be created', | ||
} | ||
|
||
export enum QUEUE_ERRORS { | ||
JOB_NOT_FOUND = 'Queue // A job with the provided id could not be found!', | ||
REDIS_NOT_AVAILABLE = 'Queue // Could not connect to Redis!', | ||
export class ExecuteError extends Error { | ||
constructor(type: ExecuteProcessorError, message?: string) { | ||
const _message = JSON.stringify({ | ||
type, | ||
message: message || ExecuteProcessorErrorMessage[type], | ||
}) | ||
super(_message) | ||
this.name = 'ExecuteError' | ||
} | ||
} | ||
|
||
export enum JOB_ERRORS { | ||
MISSING_CERTIFICATE = 'Job // Could not find the related certificate!', | ||
export interface ExecuteTransactionError { | ||
decoded?: boolean | ||
data: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters