-
Notifications
You must be signed in to change notification settings - Fork 41
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
popm/wasm: add error codes #154
Conversation
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.
LGTM
72f406d
to
9491665
Compare
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.
We need to make error code 0 "invalid". As in "it means nothing and someone did something wrong in their code" Then error codes that mean something must be != 0.
Add error codes to the WebAssembly PoP Miner. These error codes exposed in the NPM package for easy programatically handling different error types. Reviewed-on: hemilabs#154 Reviewed-by: ClaytonNorthey92 <clayton.northey@gmail.com> Reviewed-by: Marco Peereboom <marco@peereboom.us>
Summary
Add error codes to the WebAssembly PoP Miner.
These error codes will be used to programatically handle errors and display useful information to users.
The default error code is ErrorCodeInternal ("internal").
Changes
ErrorCode
type and addCode
field to the existingError
typeErrorCodeInternal
for use with internal errors (and is the default error code)ErrorCodeInvalidValue
for use when an invalid value is provided for an argument, currently only used ingenerateKey
codedError
type, used to include an error code in an error that is extracted when creating anError
that will be converted to a JavaScript ObjectMore error codes will be added as needed in future pull requests.