@@ -463,18 +463,29 @@ async fn serve_fallback(
463
463
// Check if `maybe_fallback_path` actually exists, if not, skip to the next round (which
464
464
// will check `maybe_fallback_path`s parent directory for fallback handler).
465
465
let mabye_sql_path = PathBuf :: from ( & fallback_path_candidate) ;
466
- let Ok ( sql_file ) = app_state
466
+ match app_state
467
467
. sql_file_cache
468
468
. get_with_privilege ( app_state, & mabye_sql_path, false )
469
469
. await
470
- else {
471
- log:: trace!( "The 404 handler {mabye_sql_path:?} does not exist" ) ;
472
- continue ;
473
- } ;
470
+ {
471
+ // `maybe_fallback_path` does seem to exist, lets try to run it!
472
+ Ok ( sql_file) => {
473
+ log:: debug!( "Processing SQL request via fallback: {:?}" , mabye_sql_path) ;
474
+ return render_sql ( service_request, sql_file) . await ;
475
+ }
476
+ Err ( e) => {
477
+ let actix_web_err = anyhow_err_to_actix ( e) ;
474
478
475
- // `maybe_fallback_path` does seem to exist, lets try to run it!
476
- log:: debug!( "Processing SQL request via fallback: {:?}" , mabye_sql_path) ;
477
- return render_sql ( service_request, sql_file) . await ;
479
+ // `maybe_fallback_path` does not exist, continue search in parent dir.
480
+ if actix_web_err. as_response_error ( ) . status_code ( ) == StatusCode :: NOT_FOUND {
481
+ log:: trace!( "The 404 handler {mabye_sql_path:?} does not exist" ) ;
482
+ continue ;
483
+ }
484
+
485
+ // Another error occured, bubble it up!
486
+ return Err ( actix_web_err) ;
487
+ }
488
+ }
478
489
}
479
490
480
491
log:: debug!( "There is no {catch_all:?} handler, this response is terminally failed" ) ;
0 commit comments