-
Notifications
You must be signed in to change notification settings - Fork 276
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
Implement the Error trait on ws Error type #117
Conversation
|
||
impl ::std::error::Error for Error { | ||
fn description(&self) -> &str { | ||
"Starting the JSON-RPC WebSocket server failed" |
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.
Why not delegate to wrapped errors?
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 wanted them to work the same as the http errors. Also a chain of errors (this is one error and it contains a cause that is another error) should not just chain down transparently. The intermediate steps in the chain must have relevant information, otherwise there is no information why one got the bottom level error one got.
Instead of just delegating this down one might even want to change the display implementation to be "Starting the JSON-RPC WebSocket server failed: {}"
and then format in the 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.
I have been looking in the rustc code for any standard on how the description
and Display
are implemented. But I could not find a common denominator for enums containing sub-errors.
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.
Fair enough! 👍
Could you merge with latest master so that we can see that the tests are not failing? |
@tomusdrw It is based on the latest master? Or should I merge it with master on my fork, what does that help with? |
@tomusdrw Latest master fails with the same error on my machine as well. |
Oh, ok sorry. It's probably caused by a |
Sorry once again, actually I thought that the fix is already merged, but I just made a PR: #119 |
@tomusdrw Fixed. Should hopefully build now. |
Now nightly crashes on something else. But I get that locally as well. It's a bug that I think is reported on rustc already. |
Yeah, the crash is irrelevant. Thank you so much for the PR! |
Implement the Error trait on the websocket server error type. Same reason as in #97