Skip to content

Commit

Permalink
log error when crate documentation root not found in storage
Browse files Browse the repository at this point in the history
  • Loading branch information
syphar committed Oct 11, 2023
1 parent 0fb8970 commit 17afb9a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/web/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use std::{
collections::{BTreeMap, HashMap},
sync::Arc,
};
use tracing::{debug, instrument, trace};
use tracing::{debug, error, instrument, trace};

static DOC_RUST_LANG_ORG_REDIRECTS: Lazy<HashMap<&str, &str>> = Lazy::new(|| {
HashMap::from([
Expand Down Expand Up @@ -540,6 +540,7 @@ pub(crate) async fn rustdoc_html_server_handler(
let params = params.clone();
let version = version.clone();
let storage = storage.clone();
let storage_path = storage_path.clone();
move || {
storage.rustdoc_file_exists(
&params.name,
Expand Down Expand Up @@ -571,6 +572,17 @@ pub(crate) async fn rustdoc_html_server_handler(
)?
.into_response())
} else {
if storage_path == format!("{}/index.html", krate.target_name) {
error!(
krate = params.name,
version,
original_path = original_path.as_ref(),
storage_path,
"Couldn't find crate documentation root on storage.
Something is wrong with the build."
)
}

Err(AxumNope::ResourceNotFound)
};
}
Expand Down

0 comments on commit 17afb9a

Please sign in to comment.