-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
RunError and few more error types implements Error #501
Conversation
tokio-current-thread/src/lib.rs
Outdated
fn description(&self) -> &str { | ||
"Block error" | ||
} | ||
fn cause(&self) -> Option<&Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really need to provide these cause
functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, no, I don't (I thought both were mandatory, but they are both provided in fact).
I'd still like to keep the one in the wrapper RunError
‒ as it delegates to the inner error, this is more robust for the future if the inner error might change the implementation.
Use special github syntax: |
This allows them to be used with things like `failure`.
Um… I guess this change should not be able to create data races, right? |
self.inner.description() | ||
} | ||
fn cause(&self) -> Option<&Error> { | ||
self.inner.cause() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this should be self.inner.cause()
and not just self.inner
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using self.inner.cause()
is the correct strategy here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure. But I felt this was actually the same error, just dressed in other clothes than one error causing another ‒ it wasn't like „Permission denied → Can't load configuration“ relation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
This allows them to be used with things like
failure
.This is for #491.
The descriptions are a bit unhelpful I fear, but that's because I don't know what the error means and when it can actually happen. The doc's don't say and I gave up tracking it after few layers of things calling other things and translating errors around. Nevertheless, I think this is still a step forward.