-
Notifications
You must be signed in to change notification settings - Fork 918
Convert all errors in @solana/rpc-types
to coded exceptions
#2226
Convert all errors in @solana/rpc-types
to coded exceptions
#2226
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @steveluscher and the rest of your teammates on Graphite |
f0ad0e1
to
75de449
Compare
fa52ec1
to
91d267b
Compare
if (putativeLamports < 0) { | ||
// TODO: Coded error. | ||
throw new Error('Input for 64-bit unsigned integer cannot be negative'); | ||
} | ||
|
||
if (putativeLamports > maxU64Value) { | ||
// TODO: Coded error. | ||
throw new Error('Input number is too large to be represented as a 64-bit unsigned integer'); |
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.
Sort of figured these both boiled down to ‘out of range.’
75de449
to
e14a7ef
Compare
91d267b
to
a583373
Compare
packages/errors/src/codes.ts
Outdated
export const SOLANA_ERROR__BIGINT_STRING_MALFORMED = 51 as const; | ||
export const SOLANA_ERROR__NUMBER_STRING_MALFORMED = 52 as const; |
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.
nit: We may want to stay consistent with other existing error names such as SOLANA_ERROR__MALFORMED_PROGRAM_DERIVED_ADDRESS
and use MALFORMED
as a prefixed instead of a suffix.
Unless we prefer the suffix version, in which case we should probably update the other ones.
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.
I vote prefix!
e14a7ef
to
3b46917
Compare
a583373
to
4ee6090
Compare
Merge activity
|
4ee6090
to
696be96
Compare
🎉 This PR is included in version 1.90.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Because there has been no activity on this PR for 14 days since it was merged, it has been automatically locked. Please open a new issue if it requires a follow up. |
Addresses #2118.