payjoin / rust-payjoin

Supercharged payment batching to save you fees and preserve your privacy
https://payjoindevkit.org
82 stars 34 forks source link

Review usage of `crate::receive::Error` #312

Open spacebear21 opened 1 week ago

spacebear21 commented 1 week ago

Follow-up from https://github.com/payjoin/rust-payjoin/pull/277#pullrequestreview-2139827469

Server errors are meant to be returned as a response, but are being returned in places that don't always make sense, e.g.:

https://github.com/payjoin/rust-payjoin/blob/4bc8fe362226b07becd5ea8edd839bc5a4ff7a44/payjoin/src/receive/mod.rs#L486

https://github.com/payjoin/rust-payjoin/blob/37d255e9e5e4b4aeeb8c75f96e09cbb69c00552b/payjoin-cli/src/app/v1.rs#L318

https://github.com/payjoin/rust-payjoin/blob/37d255e9e5e4b4aeeb8c75f96e09cbb69c00552b/payjoin-cli/src/app/v2.rs#L345

It would be good to review usage of crate::receive::Error and improve error nesting generally.