Skip to content

Commit efdfa75

Browse files
jyn514Joshua Nelson
authored and
Joshua Nelson
committed
Log when a file is not served because it was too big
1 parent cab5014 commit efdfa75

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/web/rustdoc.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -298,18 +298,20 @@ pub fn rustdoc_html_server_handler(req: &mut Request) -> IronResult<Response> {
298298
}
299299

300300
// Attempt to load the file from the database
301-
let file = if let Ok(file) = File::from_path(&storage, &path, &config) {
302-
file
303-
} else {
304-
// If it fails, we try again with /index.html at the end
305-
path.push_str("/index.html");
306-
req_path.push("index.html");
307-
308-
return if ctry!(req, storage.exists(&path)) {
309-
redirect(&name, &version, &req_path[3..])
310-
} else {
311-
Err(IronError::new(Nope::ResourceNotFound, status::NotFound))
312-
};
301+
let file = match File::from_path(&storage, &path, &config) {
302+
Ok(file) => file,
303+
Err(err) => {
304+
log::debug!("got error serving {}: {}", path, err);
305+
// If it fails, we try again with /index.html at the end
306+
path.push_str("/index.html");
307+
req_path.push("index.html");
308+
309+
return if ctry!(req, storage.exists(&path)) {
310+
redirect(&name, &version, &req_path[3..])
311+
} else {
312+
Err(IronError::new(Nope::ResourceNotFound, status::NotFound))
313+
};
314+
}
313315
};
314316

315317
// Serve non-html files directly

0 commit comments

Comments
 (0)