Skip to content

Commit b0050f6

Browse files
committed
better error logs on 404
1 parent 7aab04d commit b0050f6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/webserver/http.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,13 +415,14 @@ async fn process_sql_request(
415415
.sql_file_cache
416416
.get(app_state, &sql_path)
417417
.await
418+
.with_context(|| format!("Unable to get SQL file {:?}", sql_path))
418419
.map_err(anyhow_err_to_actix)?;
419420
let response = render_sql(&mut req, sql_file).await?;
420421
Ok(req.into_response(response))
421422
}
422423

423424
fn anyhow_err_to_actix(e: anyhow::Error) -> actix_web::Error {
424-
log::error!("Error while trying to get SQL file: {:#}", e);
425+
log::error!("{e:#}");
425426
match e.downcast::<ErrorWithStatus>() {
426427
Ok(err) => actix_web::Error::from(err),
427428
Err(e) => ErrorInternalServerError(format!(
@@ -442,6 +443,7 @@ async fn serve_file(
442443
.file_system
443444
.modified_since(state, path.as_ref(), since, false)
444445
.await
446+
.with_context(|| format!("Unable to get modification time of file {:?}", path))
445447
.map_err(anyhow_err_to_actix)?;
446448
if !modified {
447449
return Ok(HttpResponse::NotModified().finish());
@@ -451,6 +453,7 @@ async fn serve_file(
451453
.file_system
452454
.read_file(state, path.as_ref(), false)
453455
.await
456+
.with_context(|| format!("Unable to read file {:?}", path))
454457
.map_err(anyhow_err_to_actix)
455458
.map(|b| {
456459
HttpResponse::Ok()

0 commit comments

Comments
 (0)