@@ -10,6 +10,7 @@ use crate::proc_macro_ext::StringLit;
10
10
use crate :: syn_ext:: { IdentExt , TypeExt as _} ;
11
11
use crate :: http_codegen:: { Method , Optional } ;
12
12
use crate :: attribute:: param:: Guard ;
13
+ use crate :: exports:: mixed;
13
14
14
15
use self :: parse:: { Route , Attribute , MethodAttribute } ;
15
16
@@ -104,7 +105,7 @@ fn query_decls(route: &Route) -> Option<TokenStream> {
104
105
if !__e. is_empty( ) {
105
106
#_log:: warn_!( "Query string failed to match route declaration." ) ;
106
107
for _err in __e { #_log:: warn_!( "{}" , _err) ; }
107
- return #Outcome :: Forward ( ( #__data, #Status :: NotFound ) ) ;
108
+ return #Outcome :: Forward ( ( #__data, #Status :: UnprocessableEntity ) ) ;
108
109
}
109
110
110
111
( #( #ident. unwrap( ) ) , * )
@@ -125,9 +126,9 @@ fn request_guard_decl(guard: &Guard) -> TokenStream {
125
126
#_log:: warn_!( "Request guard `{}` is forwarding." , stringify!( #ty) ) ;
126
127
return #Outcome :: Forward ( ( #__data, __e) ) ;
127
128
} ,
128
- #Outcome :: Failure ( ( __c, __e) ) => {
129
+ #Outcome :: Error ( ( __c, __e) ) => {
129
130
#_log:: warn_!( "Request guard `{}` failed: {:?}." , stringify!( #ty) , __e) ;
130
- return #Outcome :: Failure ( __c) ;
131
+ return #Outcome :: Error ( __c) ;
131
132
}
132
133
} ;
133
134
}
@@ -145,7 +146,7 @@ fn param_guard_decl(guard: &Guard) -> TokenStream {
145
146
#_log:: warn_!( "Parameter guard `{}: {}` is forwarding: {:?}." ,
146
147
#name, stringify!( #ty) , __error) ;
147
148
148
- #Outcome :: Forward ( ( #__data, #Status :: NotFound ) )
149
+ #Outcome :: Forward ( ( #__data, #Status :: UnprocessableEntity ) )
149
150
} ) ;
150
151
151
152
// All dynamic parameters should be found if this function is being called;
@@ -188,9 +189,9 @@ fn data_guard_decl(guard: &Guard) -> TokenStream {
188
189
#_log:: warn_!( "Data guard `{}` is forwarding." , stringify!( #ty) ) ;
189
190
return #Outcome :: Forward ( ( __d, __e) ) ;
190
191
}
191
- #Outcome :: Failure ( ( __c, __e) ) => {
192
+ #Outcome :: Error ( ( __c, __e) ) => {
192
193
#_log:: warn_!( "Data guard `{}` failed: {:?}." , stringify!( #ty) , __e) ;
193
- return #Outcome :: Failure ( __c) ;
194
+ return #Outcome :: Error ( __c) ;
194
195
}
195
196
} ;
196
197
}
@@ -224,6 +225,7 @@ fn internal_uri_macro_decl(route: &Route) -> TokenStream {
224
225
}
225
226
226
227
#[ doc( hidden) ]
228
+ #[ allow( unused) ]
227
229
pub use #inner_macro_name as #macro_name;
228
230
}
229
231
}
@@ -242,7 +244,7 @@ fn responder_outcome_expr(route: &Route) -> TokenStream {
242
244
. map ( |a| quote_spanned ! ( a. span( ) => . await ) ) ;
243
245
244
246
define_spanned_export ! ( ret_span => __req, _route) ;
245
- quote_spanned ! { ret_span =>
247
+ quote_spanned ! { mixed ( ret_span) =>
246
248
let ___responder = #user_handler_fn_name( #( #parameter_names) , * ) #_await;
247
249
#_route:: Outcome :: from( #__req, ___responder)
248
250
}
0 commit comments