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

Remove weird ProviderError variants #14424

Open
mattsse opened this issue Feb 11, 2025 · 1 comment
Open

Remove weird ProviderError variants #14424

mattsse opened this issue Feb 11, 2025 · 1 comment
Assignees
Labels
C-debt A clean up/refactor of existing code C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started

Comments

@mattsse
Copy link
Collaborator

mattsse commented Feb 11, 2025

Describe the feature

due to some circular dep and no-std constraints we have these:

/// Nippy jar error.
#[error("nippy jar error: {_0}")]
NippyJar(String),
/// Trie witness error.
#[error("trie witness error: {_0}")]
TrieWitnessError(String),

for these we should introduce a new error struct where this is initialized

/// Thrown when the cache service task dropped.
#[error("cache service task stopped")]
CacheServiceUnavailable,

/// Static File is not found at specified path.
#[cfg(feature = "std")]
#[error("not able to find {_0} static file at {_1:?}")]
MissingStaticFilePath(StaticFileSegment, std::path::PathBuf),

TODO

  • remove these error variants and use:

/// Creates a new [`ProviderError::Other`] variant by wrapping the given error into an
/// [`AnyError`]
pub fn other<E>(error: E) -> Self
where
E: core::error::Error + Send + Sync + 'static,
{
Self::Other(AnyError::new(error))
}

instead, e.g.

.map_err(|err| ProviderError::NippyJar(err.to_string()))?,

would become ProviderError::other

these changes can be done 1 variant at a time

Additional context

No response

@mattsse mattsse added C-enhancement New feature or request S-needs-triage This issue needs to be labelled labels Feb 11, 2025
@mattsse mattsse added D-good-first-issue Nice and easy! A great choice to get started C-debt A clean up/refactor of existing code and removed S-needs-triage This issue needs to be labelled labels Feb 11, 2025
@VeerChaurasia
Copy link
Contributor

Hey @mattsse can i work on this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-debt A clean up/refactor of existing code C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started
Projects
Status: Todo
Development

No branches or pull requests

2 participants