Skip to content

Handle 404s and semver in source file viewer #1350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2021

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Apr 13, 2021

This also changes ctry! to print the debug version of errors so it's possible to see what goes wrong when a template fails to render.

Closes #1344. Closes #1347.

let file_list =
FileList::from_path(&mut conn, &name, &version, &req_path).ok_or(Nope::NoResults)?;
let file_list = FileList::from_path(&mut conn, &crate_name, &version, &req_path)
.ok_or(Nope::ResourceNotFound)?;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what fixed the 500 error; before it was treating this as a search page and panicking because variables weren't set.

@@ -16,7 +16,7 @@ macro_rules! ctry {
let request: &::iron::Request = $req;

::log::error!(
"called ctry!() on an `Err` value: {}\nnote: while attempting to fetch the route {:?}\n{:?}",
"called ctry!() on an `Err` value: {:?}\nnote: while attempting to fetch the route {:?}\n{:?}",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this it only shows the name of the template page that failed to render, not what the error actually was.

@jyn514 jyn514 added the S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed label Apr 14, 2021
@jyn514 jyn514 merged commit 707b8cb into rust-lang:master Apr 14, 2021
@jyn514 jyn514 deleted the source-viewer branch April 14, 2021 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed
Projects
None yet
2 participants