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

diesel: Fix reexported error types #301

Merged
merged 2 commits into from
Feb 27, 2024

Conversation

Turbo87
Copy link
Contributor

@Turbo87 Turbo87 commented Feb 23, 2024

The error type passed into managed_reexports!() generates two type aliases: PoolError<E> and HookError<E>.

PoolError<M::Error> is used e.g. by the get() fn of managed pools. But M::Error for the Manager in the deadpool_diesel crate is defined as deadpool_diesel::Error, not diesel::ConnectionError, which makes the reexport wrong or at least not as useful as it is meant to be. Interestingly, there is another PoolError type alias in the root module of deadpool_diesel with the correct generic type signature.

HookError<M::Error> is used e.g. in the post_create() fn of the managed pool builders. As above, M::Error is defined as deadpool_diesel::Error, not diesel::ConnectionError. In this case there is no correct root module type alias either, which requires users to add a dependency on deadpool itself to get to the generic, non-type-alias variant of HookError.

The error type passed into `managed_reexports!()` generates two type aliases: `PoolError<E>` and `HookError<E>`.

`PoolError<M::Error>` is used e.g. by the `get()` fn of managed pools. But `M::Error` for the `Manager` in the `deadpool_diesel` crate is defined as `deadpool_diesel::Error`, not `diesel::ConnectionError`, which makes the reexport wrong or at least not as useful as it is meant to be. Interestingly, there is another `PoolError` type alias in the root module of `deadpool_diesel` with the correct generic type signature.

`HookError<M::Error>` is used e.g. in the `post_create()` fn of the managed pool builders. As above, `M::Error` is defined as `deadpool_diesel::Error`, not `diesel::ConnectionError`. In this case there is no correct root module type alias either, which requires users to add a dependency on `deadpool` itself to get to the generic, non-type-alias variant of `HookError`.
@bikeshedder bikeshedder merged commit 1917c7e into bikeshedder:master Feb 27, 2024
62 of 63 checks passed
@Turbo87 Turbo87 deleted the diesel-errors branch February 28, 2024 06:20
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.

2 participants