Skip to content
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

HandlerError::into_response doesn't log cause #359

Closed
fpgaminer opened this issue Oct 3, 2019 · 3 comments
Closed

HandlerError::into_response doesn't log cause #359

fpgaminer opened this issue Oct 3, 2019 · 3 comments

Comments

@fpgaminer
Copy link

It looks like the code for HandlerError::into_response is supposed to log the cause of the error:

self.source().map(Error::description).unwrap_or("(none)"),

However, that doesn't seem to work; on 0.4.0 my logs just show None where the cause description should be.

As far as I can tell it's because that line is calling self.source(), but HandlerError only implements cause, not source:

impl Error for HandlerError {
fn description(&self) -> &str {
"handler failed to process request"
}
fn cause(&self) -> Option<&dyn Error> {
Some(&*self.cause)
}
}

And checking Error's default implementation, source will indeed return None by default.

Though, I haven't tested a patch to be sure that my theory is correct.

@colinbankier
Copy link
Collaborator

Thanks for the report @fpgaminer .

@whitfin
Copy link
Contributor

whitfin commented Oct 7, 2019

I've pushed up #360 which might fix this, it seems like an improvement at the very least. @fpgaminer do you want to try that patch out and see if it works as you'd expect?

@msrd0
Copy link
Member

msrd0 commented Aug 28, 2020

I believe this has been fixed in #438, if not feel free to reopen.

@msrd0 msrd0 closed this as completed Aug 28, 2020
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 a pull request may close this issue.

4 participants