-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
migrating outgoing.rs to snafu error handling #3854
Changes from 8 commits
d58b9ef
da4bc24
5af8d79
7d4c881
4475df5
540ac4a
a190e59
7754561
0752180
53f607a
b6730d4
2118718
0c10041
c52ea8a
f346a4f
1c00dcb
8d612ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
use super::*; | ||
use bitcoin::address::Error as AddressError; | ||
|
||
#[derive(Debug, Snafu)] | ||
#[snafu(context(suffix(false)), visibility(pub(crate)))] | ||
|
@@ -45,6 +46,39 @@ pub enum SnafuError { | |
}, | ||
#[snafu(display("Unrecognized representation `{}`", input))] | ||
UnrecognizedRepresentation { source: error::Error, input: String }, | ||
#[snafu(display("Unrecognized outgoing amount: `{}`", input))] | ||
UnrecognizedAmount { | ||
source: bitcoin::amount::ParseAmountError, | ||
input: String, | ||
}, | ||
#[snafu(display("Unrecognized outgoing rune: `{}`", input))] | ||
UnrecognizedRune { | ||
source: ordinals::spaced_rune::Error, | ||
input: String, | ||
}, | ||
#[snafu(display("Unrecognized outgoing sat: `{}`", input))] | ||
UnrecognizedSat { | ||
source: ordinals::sat::Error, | ||
input: String, | ||
}, | ||
#[snafu(display("Unrecognized outgoing sat point: `{}`", input))] | ||
UnrecognizedSatPoint { | ||
source: ordinals::sat_point::Error, | ||
input: String, | ||
}, | ||
#[snafu(display("Unrecognized outgoing inscription ID: `{}`", input))] | ||
UnrecognizedInscriptionId { | ||
source: inscriptions::inscription_id::ParseError, | ||
input: String, | ||
}, | ||
#[snafu(display("Unrecognized outgoing: `{}`", input))] | ||
UnrecognizedOutgoing { input: String }, | ||
#[snafu(display("Failed to parse decimal: {}", source))] | ||
DecimalParse { source: error::Error, input: String }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is only used in parsing rune amounts, then maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure thing, pushing changes now. Are you ok with having the following errors be so similar, or would you prefer to merge them? OutgoingRuneParse and RuneParse There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whoops, sorry, I wasn't looking at those other errors. Those errors can all be combined. In general, existing errors should be reused. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, updates pushed. |
||
#[snafu(display("Invalid chain `{}`", chain))] | ||
InvalidChain { chain: String }, | ||
#[snafu(display("Failed to convert script to address: {}", source))] | ||
AddressConversion { source: AddressError }, | ||
#[snafu(display("{err}"))] | ||
Anyhow { err: anyhow::Error }, | ||
#[snafu(display("environment variable `{variable}` not valid unicode: `{}`", value.to_string_lossy()))] | ||
|
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 think I would call these
*Parse
instead ofUnrecognized*
.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.
Thanks Casey - I'm pushing changes now that rename all of the
Unrecognized*
errors, except forUnrecognizedRepresentation
, because that was already merged as part of #3192.