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

feat: erase implementation-specific provider error #484

Merged
merged 1 commit into from
Oct 29, 2023

Conversation

xJonathanLEI
Copy link
Owner

Changes the Other variant of ProviderError to use a trait object instead of a generic parameter. This makes the ProviderError type much easier to work with, as errors from different Provider types are now compatible, and any type that wraps ProviderError will have one fewer generic parameter to deal with.

At the same time, it's still possible, though harder, to access the erased error type by downcasting, which requires the caller to know the concrete type at compile time, as showcased in the new example.

This is a breaking change, but it shouldn't affect downstream applications which already erase the whole ProviderError type with something like anyhow.

Changes the `Other` variant of `ProviderError` to use a trait object
instead of a generic parameter. This makes the `ProviderError` type much
easier to work with, as errors from different `Provider` types are now
compatible, and any type that wraps `ProviderError` will have one fewer
generic parameter to deal with.

At the same time, it's still possible, though harder, to access the
erased error type by downcasting, which requires the caller to know the
concrete type at compile time, as showcased in the new example.

This is a breaking change, but it shouldn't affect downstream
applications which already erase the whole `ProviderError` type with
something like `anyhow`.
@xJonathanLEI xJonathanLEI merged commit c166e93 into master Oct 29, 2023
@xJonathanLEI xJonathanLEI deleted the dev/erase_provider_err branch October 29, 2023 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant