Skip to content

Commit 4b30230

Browse files
cursoragentlovasoa
andcommitted
Update dependencies and improve file not found error handling
Co-authored-by: contact <[email protected]>
1 parent 24d6057 commit 4b30230

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

Cargo.lock

Lines changed: 19 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/filesystem.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,23 @@ impl FileSystem {
111111
(Ok(f), _) => Ok(f),
112112
(Err(e), Some(db_fs)) if e.kind() == ErrorKind::NotFound => {
113113
// no local file, try the database
114-
db_fs.read_file(app_state, path.as_ref()).await
114+
match db_fs.read_file(app_state, path.as_ref()).await {
115+
Ok(f) => Ok(f),
116+
Err(e) => {
117+
let e_str = format!("{e:#}");
118+
if e_str.contains("doesn't exist")
119+
|| e_str.contains("no such table")
120+
|| e_str.contains("Invalid object name")
121+
{
122+
Err(ErrorWithStatus {
123+
status: actix_web::http::StatusCode::NOT_FOUND,
124+
}
125+
.into())
126+
} else {
127+
Err(e)
128+
}
129+
}
130+
}
115131
}
116132
(Err(e), None) if e.kind() == ErrorKind::NotFound => Err(ErrorWithStatus {
117133
status: actix_web::http::StatusCode::NOT_FOUND,

0 commit comments

Comments
 (0)