You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have looked for existing issues (including closed) about this
Feature Request
Is it possible for us to have a better error message telling us about the wrong order of the extractors?
Motivation
I spend hours digging into the error message I faced. It makes me try every possible scenario, including trying TypedMultipart third-party crate. But it yields the same error message.
error[E0277]: the trait bound `fn(axum::extract::Multipart, axum::Extension<std::sync::Arc<context::ServerContext>>) -> impl std::future::Future<Output = std::result::Result<axum::Json<ttl::model::TtlResponse>, errors::Error>> {ttl::query::post}: axum::handler::Handler<_, _, _>` is not satisfied
--> src/routes.rs:54:34
|
54 | .route("/ttl/add/",post(ttl::query::post));
| ---- ^^^^^^^^^^^^^^^^ the trait `axum::handler::Handler<_, _, _>` is not implemented for fn item `fn(axum::extract::Multipart, axum::Extension<std::sync::Arc<context::ServerContext>>) -> impl std::future::Future<Output = std::result::Result<axum::Json<ttl::model::TtlResponse>, errors::Error>>{ttl::query::post}`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `axum::handler::Handler<T,S,B>`:
<axum::handler::Layered<L,H,T,S,B,B2>as axum::handler::Handler<T,S,B2>>
<axum::routing::MethodRouter<S,B>as axum::handler::Handler<(),S,B>>
note: required by a bound in `axum::routing::post`
--> /var/home/user/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/axum-0.6.12/src/routing/method_routing.rs:407:1
|
407 | top_level_handler_fn!(post, POST);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `post`
= note: this error originates in the macro `top_level_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
I can't solve the issue until I find the code from a project that uses Actix Multipart. Which put the multipart extractor to the last parameter.
Make the error message better. More helpful. Regarding the order of the extractors. Tell that the order of the extractor is wrong.
Alternatives
Put a more verbose warning here. I added (⚠️) so it is more noticeable.
Add other extractors to multipart form example Because most people like me, start at the examples, not the docs. This way, the readers are able to distinguish the extractor order.
The text was updated successfully, but these errors were encountered:
I wish that was possible but sadly, it's not. The best we can do is https://docs.rs/axum/0.6.12/axum/attr.debug_handler.html which has special knowledge of extractors in axum but can't know about all extractors from the ecosystem.
If you know of ways to improve things further please open another issue or PR.
Feature Request
Is it possible for us to have a better error message telling us about the wrong order of the extractors?
Motivation
I spend hours digging into the error message I faced. It makes me try every possible scenario, including trying
TypedMultipart
third-party crate. But it yields the same error message.I can't solve the issue until I find the code from a project that uses Actix Multipart. Which put the multipart extractor to the last parameter.
Proposal
Make the error message better. More helpful. Regarding the order of the extractors. Tell that the order of the extractor is wrong.
Alternatives
The text was updated successfully, but these errors were encountered: