Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion payjoin-cli/src/app/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ impl App {
if let Some(api_err) = e.api_error_ref() {
tracing::warn!("Failed to confirm error response delivery: {api_err}");
}
match e.error_state() {
match e.fatal_state() {
Some(_) => {
let id = persister.session_id();
println!(
Expand Down
6 changes: 3 additions & 3 deletions payjoin/src/core/persist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ where
}
}

pub fn error_state(self) -> Option<ErrorState> {
pub fn fatal_state(self) -> Option<ErrorState> {
match self.0 {
InternalPersistedError::Api(ApiError::FatalWithState(_, state)) => Some(state),
_ => None,
Expand Down Expand Up @@ -854,7 +854,7 @@ where

/// True if the transition failed fatally: an event was persisted, and
/// the session is closed or has moved to an error state (see
/// [`Self::error_state`]).
/// [`Self::fatal_state`]).
///
/// Storage errors are neither transient nor fatal. They mean the
/// transition outcome is unknown, and recovery is replaying the event
Expand Down Expand Up @@ -1830,7 +1830,7 @@ mod tests {
assert!(fatal_with_state_error.api_error_ref().is_some());
assert!(!fatal_with_state_error.is_transient());
assert!(fatal_with_state_error.is_fatal());
assert_eq!(fatal_with_state_error.error_state(), Some("Error state".to_string()));
assert_eq!(fatal_with_state_error.fatal_state(), Some("Error state".to_string()));

let transient_error = PersistedError::<InMemoryTestError, InMemoryTestError, (), String>(
InternalPersistedError::Api(ApiError::Transient(
Expand Down
6 changes: 3 additions & 3 deletions payjoin/src/core/receive/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ pub mod test {
.check_broadcast_suitability(Some(FeeRate::MIN), |_| Ok(false))
.save(&persister)
.expect_err("should have replyable error");
let has_error = unchecked_proposal_err.error_state().expect("should have state");
let has_error = unchecked_proposal_err.fatal_state().expect("should have state");

let _err_req = has_error.create_error_request(EXAMPLE_URL)?;
Ok(())
Expand Down Expand Up @@ -2182,7 +2182,7 @@ pub mod test {
.expect_err("fatal response should error");

assert!(err.api_error_ref().is_some());
let pending_fallback = err.error_state().expect("pending fallback should be carried");
let pending_fallback = err.fatal_state().expect("pending fallback should be carried");
assert_eq!(pending_fallback.fallback_tx(), &expected_tx);
assert_events(&persister, &[SessionEvent::ProtocolFailed], false);
Ok(())
Expand Down Expand Up @@ -2241,7 +2241,7 @@ pub mod test {
.process_response(&response, ctx)
.save(&persister)
.expect_err("fatal response should error");
let pending_fallback = err.error_state().expect("pending fallback should be carried");
let pending_fallback = err.fatal_state().expect("pending fallback should be carried");

assert_eq!(pending_fallback.fallback_tx(), &expected_tx);
assert_events(&persister, &[SessionEvent::ProtocolFailed], false);
Expand Down
Loading