Skip to content

Conversation

Nemo157
Copy link
Contributor

@Nemo157 Nemo157 commented Jun 2, 2020

Results in logs like

web_1  | 2020/06/02 08:13:07 [ERROR] cratesfyi::web: internal server error: Error rendering "releases_feed" line 10, col 10: Helper not defined: "content"

and a page like

image

when I reapply the bug in #728

Fixes #801

src/web/mod.rs Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggestions on ways to rewrite this would be appreciated, seems like it needs some sort of conditional or_else_if(|e| e.response.status == Some(status::NotFound), |e| self.router_handler.handle(req)).

Copy link
Member

@jyn514 jyn514 Jun 2, 2020

Choose a reason for hiding this comment

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

I think a helper handle_if_404 closure would be nice.

Copy link
Member

Choose a reason for hiding this comment

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

Something like

let handle_if_404 = |e, handler| if e.response.status == Some(status::NotFound) {
    handler(req)
} else {
    Err(e)
};

@Nemo157 Nemo157 force-pushed the chain-404 branch 2 times, most recently from 7775b99 to 438b9e9 Compare June 2, 2020 08:41
src/web/error.rs Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to link to the GitHub page so people can make an issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Might be a good followup issue to do once the template changes are in, all the error pages could do with a bit of a sprucing up.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think asking to open an issue on GitHub this way is much beneficial for us: without a backtrace it's hard to then debug those issues.

A thing we could do is generate a random UUID, print it in the same line as the error and show it in the error page, so when people open the issue we can simply do a journalctl -u docs.rs | grep UUID to get the exact error the user encountered.

Copy link
Member

Choose a reason for hiding this comment

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

The UUID sounds useful but it can go in a follow-up, for now I want to get the bug fix in.

src/web/mod.rs Outdated
Copy link
Member

@jyn514 jyn514 Jun 2, 2020

Choose a reason for hiding this comment

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

I think a helper handle_if_404 closure would be nice.

src/web/error.rs Outdated
Copy link
Member

Choose a reason for hiding this comment

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

The UUID sounds useful but it can go in a follow-up, for now I want to get the bug fix in.

@jyn514 jyn514 merged commit 14eecac into rust-lang:master Jun 3, 2020
@Nemo157 Nemo157 deleted the chain-404 branch June 3, 2020 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs.rs reports 404s for internal server errors

3 participants