File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 1
1
use std:: sync:: Arc ;
2
2
3
3
use conduit:: { Handler , HandlerResult , RequestExt } ;
4
- use conduit_router:: { RequestParams , RouteBuilder } ;
4
+ use conduit_router:: { RequestParams , RouteBuilder , RouterError } ;
5
5
6
6
use crate :: controllers:: * ;
7
7
use crate :: util:: errors:: { std_error, AppError , NotFound } ;
@@ -173,12 +173,9 @@ pub struct R404(pub RouteBuilder);
173
173
impl Handler for R404 {
174
174
fn call ( & self , req : & mut dyn RequestExt ) -> HandlerResult {
175
175
let R404 ( ref router) = * self ;
176
- match router. recognize ( & req. method ( ) , req. path ( ) ) {
177
- Ok ( m) => {
178
- req. mut_extensions ( ) . insert ( m. params ( ) . clone ( ) ) ;
179
- m. handler ( ) . call ( req)
180
- }
181
- Err ( ..) => Ok ( NotFound . into ( ) ) ,
176
+ match router. call ( req) {
177
+ Err ( e) if e. downcast_ref :: < RouterError > ( ) . is_some ( ) => Ok ( NotFound . into ( ) ) ,
178
+ other => other,
182
179
}
183
180
}
184
181
}
You can’t perform that action at this time.
0 commit comments