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

Commits on Feb 23, 2024

  1. Configuration menu
    Copy the full SHA
    a415107 View commit details
    Browse the repository at this point in the history
  2. diesel: Fix reexported error types

    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`.
    Turbo87 committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    c84fcc7 View commit details
    Browse the repository at this point in the history