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

payjoin / rust-payjoin / 17626157953

10 Sep 2025 08:34PM UTC coverage: 86.019% (+0.09%) from 85.926%
17626157953

Pull #950

github

web-flow
Merge 8fd9405ba into 52cfeef1a
Pull Request #950: Sanitize sensitive data from log messages to prevent privacy leaks

7 of 8 new or added lines in 6 files covered. (87.5%)

117 existing lines in 7 files now uncovered.

8232 of 9570 relevant lines covered (86.02%)

488.64 hits per line

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

45.0
/payjoin/src/core/error.rs
1
use std::fmt::Debug;
2
use std::{error, fmt};
3

4
#[derive(Debug)]
5
pub struct ImplementationError(Box<dyn error::Error + Send + Sync>);
6

7
impl ImplementationError {
8
    pub fn new(e: impl error::Error + Send + Sync + 'static) -> Self {
6✔
9
        ImplementationError(Box::new(e))
6✔
10
    }
6✔
11
}
12

13
impl fmt::Display for ImplementationError {
14
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { std::fmt::Display::fmt(&self.0, f) }
17✔
15
}
16

17
impl error::Error for ImplementationError {
UNCOV
18
    fn source(&self) -> Option<&(dyn error::Error + 'static)> { Some(self.0.as_ref()) }
×
19
}
20

21
impl PartialEq for ImplementationError {
UNCOV
22
    fn eq(&self, _: &Self) -> bool { false }
×
23
}
24

25
impl Eq for ImplementationError {}
26

27
impl From<Box<dyn error::Error + Send + Sync>> for ImplementationError {
28
    fn from(e: Box<dyn error::Error + Send + Sync>) -> Self { ImplementationError(e) }
24✔
29
}
30

31
impl From<&str> for ImplementationError {
32
    fn from(e: &str) -> Self {
24✔
33
        let error = Box::<dyn error::Error + Send + Sync>::from(e);
24✔
34
        ImplementationError::from(error)
24✔
35
    }
24✔
36
}
37
/// Errors that can occur when replaying a session event log
38
#[cfg(feature = "v2")]
39
#[derive(Debug)]
40
pub struct ReplayError<SessionState, SessionEvent>(InternalReplayError<SessionState, SessionEvent>);
41

42
#[cfg(feature = "v2")]
43
impl<SessionState: Debug, SessionEvent: Debug> std::fmt::Display
44
    for ReplayError<SessionState, SessionEvent>
45
{
UNCOV
46
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
×
47
        use InternalReplayError::*;
UNCOV
48
        match &self.0 {
×
UNCOV
49
            NoEvents => write!(f, "No events found in session"),
×
UNCOV
50
            InvalidEvent(event, session) => match session {
×
UNCOV
51
                Some(session) => write!(f, "Invalid event ({event:?}) for session ({session:?})",),
×
UNCOV
52
                None => write!(f, "Invalid first event ({event:?}) for session",),
×
53
            },
UNCOV
54
            PersistenceFailure(e) => write!(f, "Persistence failure: {e}"),
×
55
        }
UNCOV
56
    }
×
57
}
58
#[cfg(feature = "v2")]
59
impl<SessionState: Debug, SessionEvent: Debug> std::error::Error
60
    for ReplayError<SessionState, SessionEvent>
61
{
62
}
63

64
#[cfg(feature = "v2")]
65
impl<SessionState: Debug, SessionEvent: Debug> From<InternalReplayError<SessionState, SessionEvent>>
66
    for ReplayError<SessionState, SessionEvent>
67
{
UNCOV
68
    fn from(e: InternalReplayError<SessionState, SessionEvent>) -> Self { ReplayError(e) }
×
69
}
70

71
#[cfg(feature = "v2")]
72
#[derive(Debug)]
73
pub(crate) enum InternalReplayError<SessionState, SessionEvent> {
74
    /// No events in the event log
75
    NoEvents,
76
    /// Invalid initial event
77
    InvalidEvent(Box<SessionEvent>, Option<Box<SessionState>>),
78
    /// Application storage error
79
    PersistenceFailure(ImplementationError),
80
}
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