-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1994 taquito local forging error improvement #2486
Merged
hui-an-yang
merged 13 commits into
error-improvement
from
1994-taquito-local-forging-error-improvement
May 18, 2023
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
51c2bc7
refactor: update file name of error.ts to errors.ts for consistency
hui-an-yang 71eca13
refactor: improve InvalidOperationSchemaError
hui-an-yang 9eda1ec
refactor: improve OversizedEntryPointError
hui-an-yang 6ce9d84
refactor: improve InvalidBallotValueError
hui-an-yang 361bd44
refactor: improve DecodeBallotValueError
hui-an-yang 75eeff3
refactor: imrpove UnexpectedMichelsonValueError
hui-an-yang 8bd8bb8
refactor: improve OperationDecodingError
hui-an-yang b7bd237
refactor: imporve OperationEncodingError
hui-an-yang af4b1eb
Merge branch 'error-improvement' of github.com:ecadlabs/taquito into …
hui-an-yang 14e8d19
refactor: imrpove UnsupportedOperationError
hui-an-yang c9d1929
refactor: improve DecodePvmKindError
hui-an-yang 5c33012
refactor: improve InvalidSmartRollupAddressError
hui-an-yang 02824ea
refactor: improve InvalidSmartRollupCommitmentHashError and DecodePvm…
hui-an-yang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,147 @@ | ||
import { ParameterValidationError } from '@taquito/core'; | ||
import { OperationContents } from '@taquito/rpc'; | ||
import { ENTRYPOINT_MAX_LENGTH } from './constants'; | ||
|
||
/** | ||
* @category Error | ||
* @description Error indicates an invalid operation content being passed or used | ||
*/ export class InvalidOperationSchemaError extends ParameterValidationError { | ||
constructor(public operation: OperationContents, errorDetail?: string) { | ||
super(); | ||
this.name = 'InvalidOperationSchemaError'; | ||
this.message = `Invalid operation content recevied`; | ||
errorDetail ? (this.message += ` ${errorDetail}.`) : ''; | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error indicates an entrypoint name exceeding maximum length | ||
*/ | ||
export class OversizedEntryPointError extends ParameterValidationError { | ||
constructor(public entrypoint: string) { | ||
super(); | ||
this.name = 'OversizedEntryPointError'; | ||
this.message = `Invalid entrypoint length "${entrypoint.length}", maximum length is "${ENTRYPOINT_MAX_LENGTH}".`; | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error indicates an invalid ballot value being used | ||
*/ | ||
export class InvalidBallotValueError extends ParameterValidationError { | ||
constructor(public ballotValue: string) { | ||
super(); | ||
this.name = 'InvalidBallotValueError'; | ||
this.message = `Invalid ballot value "${ballotValue}" expecting one of the following: "yay", "nay", "pass".`; | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error indicates a failure when trying to decode ballot value | ||
*/ | ||
export class DecodeBallotValueError extends ParameterValidationError { | ||
constructor(public ballotValue: string) { | ||
super(); | ||
this.name = 'DecodeBallotValueError'; | ||
this.message = `Invalid ballot value "${ballotValue}", cannot be decoded.`; | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error indicates unexpected Michelson Value being passed or used | ||
*/ | ||
export class UnexpectedMichelsonValueError extends ParameterValidationError { | ||
constructor(public value: string) { | ||
super(); | ||
this.name = 'UnexpectedMichelsonValueError'; | ||
this.message = `Invalid Michelson value "${value}", unalbe to encode.`; | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error indicates a failure when trying to decode an operation | ||
*/ | ||
export class OperationDecodingError extends ParameterValidationError { | ||
constructor(public message: string) { | ||
super(); | ||
this.name = 'OperationDecodingError'; | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error indicates a failure when trying to encode an operation | ||
*/ | ||
export class OperationEncodingError extends ParameterValidationError { | ||
constructor(public message: string) { | ||
super(); | ||
this.name = 'OperationEncodingError'; | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error indicates an unsupported operation being passed or used | ||
*/ | ||
export class UnsupportedOperationError extends ParameterValidationError { | ||
constructor(public op: string) { | ||
super(); | ||
this.name = 'UnsupportedOperationError'; | ||
this.message = `Unsupported operation "${op}", can submit an issue on our github for feature request.`; | ||
} | ||
} | ||
|
||
/** | ||
* @cateogry Error | ||
* @description Error indicates an unsupported pvm being passed or used | ||
*/ | ||
export class UnsupportedPvmKindError extends ParameterValidationError { | ||
constructor(public pvm: string) { | ||
super(); | ||
this.name = 'UnsupportedPvmKindError'; | ||
this.message = `Invalid Pvm kind "${pvm}" expecting either "arith" or "wasm_2_0_0".`; | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error indicates an unsupported pvm to decode | ||
*/ | ||
export class DecodePvmKindError extends ParameterValidationError { | ||
constructor(public pvm: string) { | ||
super(); | ||
this.name = 'DecodePvmKindError'; | ||
this.message = `Invalid Pvm kind "${pvm}", cannot be decoded.`; | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error indicates an invalid Smart Rollup Address (sr1) | ||
*/ | ||
export class InvalidSmartRollupAddressError extends ParameterValidationError { | ||
constructor(public address: string, errorDetail?: string) { | ||
super(); | ||
this.name = 'InvalidSmartRollupAddress'; | ||
this.message = `Invalid smart rollup address "${address}"`; | ||
errorDetail ? (this.message += ` ${errorDetail}.`) : ''; | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error indicates an invalid Smart Rollup commitment hash (src1) | ||
*/ | ||
export class InvalidSmartRollupCommitmentHashError extends ParameterValidationError { | ||
constructor(public hash: string, errorDetail?: string) { | ||
super(); | ||
this.name = 'InvalidSmartRollupCommitmentHashError' | ||
this.message = `Invalid smart rollup commitment hash "${hash}"` | ||
errorDetail ? (this.message += ` ${errorDetail}.`) : ''; | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, thanks for fixing this