-
Notifications
You must be signed in to change notification settings - Fork 70
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
Update error handling in cli-app #470
Conversation
Thanks for the PR! I'll get to reviewing this ASAP. |
Reviewed, but I forgot to click the "changes requested" button. :) Let me know what you think. |
I've added an error handler for catching errors from
However, it seems like when
Once I don't see any harm in catching an error from |
Interesting that the error case may be unreachable thanks to the semantics of |
Expecting CLI app tests to fail until the testnet comes back up:
This does raise an interesting point - some unit tests will fail without an internet connection. (Edit) this will be fixed by #487. A manual fixup should be done after both are merged but it shouldn't be difficult. |
I haven't thought of anything else to add - the new tests exercise the new error types at least to some extent (excepting a It would be cool to spin up a node and add some runtime checks, but that might be best left as a separate endeavor? |
This is the goal of the |
Yes, adding integration testing like this is unnecessary at this point (the existing tests for the HTTP API elsewhere in the repo should suffice, and if they don't that should be fixed elsewhere). |
Can you rebase on top of #487? |
9477e99
to
dbecfa8
Compare
Rebase finished, went smoothly. |
@KevinWMatthews I've pushed some changes, what do you think? I couldn't resist giving thiserror a spin (it's real nice, turns out), and on consideration I don't think we really need the should-fail tests for ProtocolErr and UsageErr. |
@bstrie Nice! I see what you mean about That's fine if you want to omit tests for I see what you did in |
d7be426
to
7eef72e
Compare
Rebased onto lastest master. |
@KevinWMatthews we had some flakiness which should be fixed in master now. |
Match the entire tuple rather than matching the tuple values individually. Signed-off-by: Kevin W Matthews <[email protected]>
While these commands may fail at runtime, parsing should not panic. Signed-off-by: Kevin W Matthews <[email protected]>
Extend the cli's Error enum and implement the From trait to allow the try operator to be used. Signed-off-by: Kevin W Matthews <[email protected]>
Signed-off-by: Kevin W Matthews <[email protected]>
Signed-off-by: Kevin W Matthews <[email protected]>
@KevinWMatthews thanks again for your work here! Sorry that it took some time to merge, we've had various events and travel to prepare for that have been occupying much of our bandwidth. |
@bstrie No worries! I understand the need to prioritize. |
The cli app will panic in
ws_account_payments_incoming
for several legitimate use cases:This extends the
interpreter.rs
module'sError
enum, allowing the?
to gracefully report failures to the end user. Is this the style you prefer for error handling?A few other notes:
ClientErr
, say,RequestErr
?socket.read_message().expect("Could not receive WebSocket message")
occur in normal use?NodeClient::ws_account_payments_incoming()
.