Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sequencer-relayer: add utility function for asserting error variants #1581

Open
ethanoroshiba opened this issue Sep 27, 2024 · 0 comments
Open
Assignees
Labels
code-quality sequencer-relayer pertaining to the astria-sequencer-relayer crate

Comments

@ethanoroshiba
Copy link
Contributor

ethanoroshiba commented Sep 27, 2024

We should add a utility function assert_error_variant to avoid manual matches throughout both these files:

// allow: `assert!(matches!(..))` provides poor feedback on failure.
#[allow(clippy::manual_assert)]
if !matches!(error, Error::ReadFile(_)) {
panic!("expected an error variant `Error::ReadFile`, got {error:?}");
}

// allow: `assert!(matches!(..))` provides poor feedback on failure.
#[allow(clippy::manual_assert)]
if !matches!(error, TrySubmitError::BlobTooLarge { byte_count } if byte_count == u32::MAX as usize + 1)
{
panic!("expected `Error::BlobTooLarge` with byte_count == u32::MAX + 1, got {error:?}");
}

┆Issue Number: ENG-873

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-quality sequencer-relayer pertaining to the astria-sequencer-relayer crate
Projects
None yet
Development

No branches or pull requests

1 participant