Skip to content

Commit 6263f84

Browse files
committed
fix handling of "not found" errors
HTTP 500 were returned instead of HTTP 404
1 parent 02261f4 commit 6263f84

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/webserver/http.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use futures_util::StreamExt;
2121
use std::borrow::Cow;
2222
use std::collections::hash_map::Entry;
2323
use std::collections::HashMap;
24-
use std::io::{self, Write};
24+
use std::io::Write;
2525
use std::mem;
2626
use std::net::IpAddr;
2727
use std::path::PathBuf;
@@ -405,7 +405,11 @@ async fn process_sql_request(
405405
.await
406406
.map_err(|e| {
407407
log::error!("Error while trying to get SQL file: {:#}", e);
408-
if e.downcast_ref().map(io::Error::kind) == Some(io::ErrorKind::NotFound) {
408+
if e.downcast_ref()
409+
== Some(&ErrorWithStatus {
410+
status: StatusCode::NOT_FOUND,
411+
})
412+
{
409413
ErrorNotFound("The requested file was not found.")
410414
} else {
411415
ErrorInternalServerError(format!(

0 commit comments

Comments
 (0)