Skip to content

Mislabeled exception when unable to resolve dependency graph #133

Description

@m1guelpf

I was very confused when I got this error pointing to the default route that comes with the template.

ERROR: 
  x I don't know how to handle the type returned by `app::routes::system::health_check`.
  |
  |     ,-[app/src/routes/mod.rs:10:1]
  |  10 | pub fn handler(bp: &mut Blueprint) {
  |  11 |     bp.route(GET, "/healthz", f!(crate::routes::system::health_check));
  |     :                               ^^^^^^^^^^^^^^^^^^^|^^^^^^^^^^^^^^^^^^^
  |     :                                                  `-- The request handler was registered here
  |  12 | }
  |     `----
  |    ,-[app/src/routes/system.rs:4:1]
  |  4 | #[must_use]
  |  5 | pub const fn health_check() -> StatusCode {
  |    :                                ^^^^^|^^^^
  |    :                                     `-- The output type that I can't handle
  |  6 |     StatusCode::OK
  |    `----

Turns out, the error triggers when you try to import a crate which uses a different version of a dependency your app crate also requires. I've created an example repo with two commits. The first one does not compile with the above error, while mirroring the features on the app crate compiles without issues.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions