Skip to content

Commit

Permalink
NFC: Clarify is_fatal().
Browse files Browse the repository at this point in the history
  • Loading branch information
briansmith committed Sep 30, 2023
1 parent 7793842 commit 2ad08d7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ pub(crate) enum InternalError {
MaximumPathBuildCallsExceeded,
}

impl InternalError {
fn is_fatal(&self) -> bool {
matches!(
self,
Self::MaximumSignatureChecksExceeded | Self::MaximumPathBuildCallsExceeded
)
}
}

pub(crate) enum ErrorOrInternalError {
Error(Error),
InternalError(InternalError),
Expand All @@ -125,10 +134,7 @@ impl ErrorOrInternalError {
pub fn is_fatal(&self) -> bool {
match self {
ErrorOrInternalError::Error(_) => false,
ErrorOrInternalError::InternalError(InternalError::MaximumSignatureChecksExceeded)
| ErrorOrInternalError::InternalError(InternalError::MaximumPathBuildCallsExceeded) => {
true
}
ErrorOrInternalError::InternalError(e) => e.is_fatal(),
}
}
}
Expand Down

0 comments on commit 2ad08d7

Please sign in to comment.