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

payjoin / rust-payjoin / 13845673562

13 Mar 2025 10:17PM UTC coverage: 80.614% (-0.02%) from 80.631%
13845673562

Pull #579

github

web-flow
Merge 8fb0f6038 into 13e8c6b6e
Pull Request #579: Make serialize_url and extract_v1 infallible

14 of 15 new or added lines in 6 files covered. (93.33%)

11 existing lines in 1 file now uncovered.

4828 of 5989 relevant lines covered (80.61%)

771.59 hits per line

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

0.0
/payjoin/src/send/multiparty/error.rs
1
use std::fmt::{self, Display};
2

3
use bitcoin::psbt::Error as PsbtError;
4

5
use crate::hpke::HpkeError;
6
use crate::ohttp::OhttpEncapsulationError;
7
use crate::receive::ImplementationError;
8
use crate::send::InternalProposalError;
9
use crate::uri::url_ext::ParseReceiverPubkeyParamError;
10

11
#[derive(Debug)]
12
pub struct CreateRequestError(InternalCreateRequestError);
13

14
#[derive(Debug)]
15
pub(crate) enum InternalCreateRequestError {
16
    #[allow(dead_code)]
17
    Expired(std::time::SystemTime),
18
    MissingOhttpConfig,
19
    ParseReceiverPubkeyParam(ParseReceiverPubkeyParamError),
20
    Url(url::ParseError),
21
    V2CreateRequest(crate::send::v2::CreateRequestError),
22
}
23

24
impl From<InternalCreateRequestError> for CreateRequestError {
UNCOV
25
    fn from(value: InternalCreateRequestError) -> Self { CreateRequestError(value) }
×
26
}
27

28
impl Display for CreateRequestError {
UNCOV
29
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self.0) }
×
30
}
31

32
impl std::error::Error for CreateRequestError {
33
    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
×
34
        match &self.0 {
×
35
            InternalCreateRequestError::Expired(_) => None,
×
36
            InternalCreateRequestError::MissingOhttpConfig => None,
×
37
            InternalCreateRequestError::ParseReceiverPubkeyParam(e) => Some(e),
×
38
            InternalCreateRequestError::Url(e) => Some(e),
×
39
            InternalCreateRequestError::V2CreateRequest(e) => Some(e),
×
40
        }
UNCOV
41
    }
×
42
}
43

44
#[derive(Debug)]
45
pub struct FinalizedError(InternalFinalizedError);
46

47
#[derive(Debug)]
48
pub(crate) enum InternalFinalizedError {
49
    Hpke(HpkeError),
50
    InvalidSize,
51
    #[allow(dead_code)]
52
    FinalizePsbt(ImplementationError),
53
    MissingResponse,
54
    Psbt(PsbtError),
55
    #[allow(dead_code)]
56
    UnexpectedStatusCode(http::StatusCode),
57
    Proposal(InternalProposalError),
58
    Ohttp(OhttpEncapsulationError),
59
}
60

61
impl From<InternalFinalizedError> for FinalizedError {
UNCOV
62
    fn from(value: InternalFinalizedError) -> Self { FinalizedError(value) }
×
63
}
64

65
impl Display for FinalizedError {
UNCOV
66
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self.0) }
×
67
}
68

69
impl std::error::Error for FinalizedError {
70
    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
×
71
        match &self.0 {
×
72
            InternalFinalizedError::Hpke(e) => Some(e),
×
73
            InternalFinalizedError::InvalidSize => None,
×
74
            InternalFinalizedError::FinalizePsbt(_) => None,
×
75
            InternalFinalizedError::MissingResponse => None,
×
76
            InternalFinalizedError::Psbt(e) => Some(e),
×
77
            InternalFinalizedError::UnexpectedStatusCode(_) => None,
×
UNCOV
78
            InternalFinalizedError::Proposal(e) => Some(e),
×
79
            InternalFinalizedError::Ohttp(e) => Some(e),
×
80
        }
UNCOV
81
    }
×
82
}
83

84
#[derive(Debug)]
85
pub struct FinalizeResponseError(InternalFinalizeResponseError);
86

87
#[derive(Debug)]
88
pub(crate) enum InternalFinalizeResponseError {
89
    #[allow(dead_code)]
90
    InvalidSize(usize),
91
    Ohttp(OhttpEncapsulationError),
92
    #[allow(dead_code)]
93
    UnexpectedStatusCode(http::StatusCode),
94
}
95

96
impl From<InternalFinalizeResponseError> for FinalizeResponseError {
UNCOV
97
    fn from(value: InternalFinalizeResponseError) -> Self { FinalizeResponseError(value) }
×
98
}
99

100
impl Display for FinalizeResponseError {
UNCOV
101
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self.0) }
×
102
}
103

104
impl std::error::Error for FinalizeResponseError {
105
    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
×
106
        match &self.0 {
×
107
            InternalFinalizeResponseError::InvalidSize(_) => None,
×
UNCOV
108
            InternalFinalizeResponseError::Ohttp(e) => Some(e),
×
109
            InternalFinalizeResponseError::UnexpectedStatusCode(_) => None,
×
110
        }
UNCOV
111
    }
×
112
}
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