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

payjoin / rust-payjoin / 15618585178

12 Jun 2025 06:48PM UTC coverage: 85.89% (+0.3%) from 85.633%
15618585178

Pull #748

github

web-flow
Merge d6b02e4f2 into 9070bb25e
Pull Request #748: Full mutation coverage on send in the payjoin crate

118 of 131 new or added lines in 5 files covered. (90.08%)

6 existing lines in 1 file now uncovered.

7128 of 8299 relevant lines covered (85.89%)

559.58 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::DirectoryResponseError;
7
use crate::send::InternalProposalError;
8
use crate::uri::url_ext::ParseReceiverPubkeyParamError;
9
use crate::ImplementationError;
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
    V2CreateRequest(crate::send::v2::CreateRequestError),
21
}
22

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

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

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

42
#[derive(Debug)]
43
pub struct FinalizedError(InternalFinalizedError);
44

45
#[derive(Debug)]
46
pub(crate) enum InternalFinalizedError {
47
    Hpke(HpkeError),
48
    #[allow(dead_code)]
49
    FinalizePsbt(ImplementationError),
50
    MissingResponse,
51
    Psbt(PsbtError),
52
    DirectoryResponse(DirectoryResponseError),
53
    Proposal(InternalProposalError),
54
}
55

56
impl From<InternalFinalizedError> for FinalizedError {
57
    fn from(value: InternalFinalizedError) -> Self { FinalizedError(value) }
×
58
}
59

60
impl From<DirectoryResponseError> for FinalizedError {
NEW
61
    fn from(err: DirectoryResponseError) -> Self {
×
NEW
62
        FinalizedError(InternalFinalizedError::DirectoryResponse(err))
×
NEW
63
    }
×
64
}
65

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

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

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

86
#[derive(Debug)]
87
pub(crate) enum InternalFinalizeResponseError {
88
    DirectoryResponse(DirectoryResponseError),
89
}
90

91
impl From<InternalFinalizeResponseError> for FinalizeResponseError {
92
    fn from(value: InternalFinalizeResponseError) -> Self { FinalizeResponseError(value) }
×
93
}
94

95
impl From<DirectoryResponseError> for FinalizeResponseError {
NEW
96
    fn from(err: DirectoryResponseError) -> Self {
×
NEW
97
        FinalizeResponseError(InternalFinalizeResponseError::DirectoryResponse(err))
×
NEW
98
    }
×
99
}
100

101
impl fmt::Display for FinalizeResponseError {
102
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
×
103
        use InternalFinalizeResponseError::*;
104

UNCOV
105
        match &self.0 {
×
106
            DirectoryResponse(e) => write!(f, "Directory response error: {e}"),
×
107
        }
×
NEW
108
    }
×
109
}
110

111
impl std::error::Error for FinalizeResponseError {
UNCOV
112
    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
×
113
        use InternalFinalizeResponseError::*;
114

UNCOV
115
        match &self.0 {
×
UNCOV
116
            DirectoryResponse(e) => Some(e),
×
UNCOV
117
        }
×
UNCOV
118
    }
×
119
}
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