• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

payjoin / rust-payjoin / 14130416010

28 Mar 2025 01:48PM UTC coverage: 81.699% (+0.2%) from 81.45%
14130416010

push

github

web-flow
Reply json (#606)

Fix #605

72 of 108 new or added lines in 7 files covered. (66.67%)

5 existing lines in 3 files now uncovered.

5107 of 6251 relevant lines covered (81.7%)

739.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/payjoin/src/error_codes.rs
1
//! Well-known error codes as defined in BIP-78
2
//! See: <https://github.com/bitcoin/bips/blob/master/bip-0078.mediawiki#receivers-well-known-errors>
3

4
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5
pub enum ErrorCode {
6
    /// The payjoin endpoint is not available for now.
7
    Unavailable,
8
    /// The receiver added some inputs but could not bump the fee of the payjoin proposal.
9
    NotEnoughMoney,
10
    /// This version of payjoin is not supported.
11
    VersionUnsupported,
12
    /// The receiver rejected the original PSBT.
13
    OriginalPsbtRejected,
14
}
15

16
impl ErrorCode {
17
    pub const fn as_str(&self) -> &'static str {
3✔
18
        match self {
3✔
19
            Self::Unavailable => "unavailable",
2✔
NEW
20
            Self::NotEnoughMoney => "not-enough-money",
×
NEW
21
            Self::VersionUnsupported => "version-unsupported",
×
22
            Self::OriginalPsbtRejected => "original-psbt-rejected",
1✔
23
        }
24
    }
3✔
25
}
26

27
impl core::str::FromStr for ErrorCode {
28
    type Err = ();
29

30
    fn from_str(s: &str) -> Result<Self, Self::Err> {
3✔
31
        match s {
3✔
32
            "unavailable" => Ok(Self::Unavailable),
3✔
33
            "not-enough-money" => Ok(Self::NotEnoughMoney),
3✔
34
            "version-unsupported" => Ok(Self::VersionUnsupported),
3✔
35
            "original-psbt-rejected" => Ok(Self::OriginalPsbtRejected),
1✔
36
            _ => Err(()),
1✔
37
        }
38
    }
3✔
39
}
40

41
impl core::fmt::Display for ErrorCode {
42
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
3✔
43
        f.write_str(self.as_str())
3✔
44
    }
3✔
45
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc