mirror of
https://github.com/YGGverse/nexy.git
synced 2026-03-31 17:25:27 +00:00
handle not found error
This commit is contained in:
parent
b1360eab2e
commit
9980d20c21
3 changed files with 9 additions and 3 deletions
|
|
@ -9,6 +9,7 @@ pub enum Response<'a> {
|
|||
},
|
||||
NotFound {
|
||||
query: &'a str,
|
||||
error: String,
|
||||
},
|
||||
File(&'a [u8]),
|
||||
Directory {
|
||||
|
|
|
|||
|
|
@ -148,9 +148,9 @@ impl Connection {
|
|||
);
|
||||
self.session.template.access_denied()
|
||||
}
|
||||
Response::NotFound { query } => {
|
||||
Response::NotFound { query, error } => {
|
||||
eprintln!(
|
||||
"[{}] < [{}] requested resource `{query}` not found.",
|
||||
"[{}] < [{}] requested resource `{query}` not found: {error}.",
|
||||
self.address.server, self.address.client
|
||||
);
|
||||
self.session.template.not_found()
|
||||
|
|
|
|||
|
|
@ -54,7 +54,12 @@ impl Public {
|
|||
}
|
||||
c
|
||||
}
|
||||
Err(_) => return callback(Response::NotFound { query }),
|
||||
Err(e) => {
|
||||
return callback(Response::NotFound {
|
||||
query,
|
||||
error: e.to_string(),
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
match fs::metadata(&p) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue