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

payjoin / rust-payjoin / 27162641746

08 Jun 2026 07:51PM UTC coverage: 85.369% (+0.01%) from 85.358%
27162641746

Pull #1399

github

GitHub
Merge 602f79655 into d76374b5a
Pull Request #1399: Split resume session relays

48 of 70 new or added lines in 3 files covered. (68.57%)

504 existing lines in 17 files now uncovered.

12545 of 14695 relevant lines covered (85.37%)

370.93 hits per line

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

88.89
/payjoin/src/core/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, serde::Serialize, serde::Deserialize)]
5
#[non_exhaustive]
6
pub enum ErrorCode {
7
    /// The payjoin endpoint is not available for now.
8
    Unavailable,
9
    /// The receiver added some inputs but could not bump the fee of the payjoin proposal.
10
    NotEnoughMoney,
11
    /// This version of payjoin is not supported.
12
    VersionUnsupported,
13
    /// The receiver rejected the original PSBT.
14
    OriginalPsbtRejected,
15
}
16

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

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

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

42
impl core::fmt::Display for ErrorCode {
43
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
13✔
44
        f.write_str(self.as_str())
13✔
45
    }
13✔
46
}
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