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

unreachable! #60

Closed
malik672 opened this issue Dec 2, 2023 · 4 comments
Closed

unreachable! #60

malik672 opened this issue Dec 2, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@malik672
Copy link

malik672 commented Dec 2, 2023

Component

providers

Describe the feature you would like

in the crate dir, under rpc-client/call.rs for error handling the code currently uses unreachable! when it encounters an incorrect state. won't it be better to use custom errors Instead of using unreachable! or maybe i'm missing something

Additional context

No response

@malik672 malik672 added the enhancement New feature or request label Dec 2, 2023
@robinsdan
Copy link
Contributor

because the state is checked in the poll function, it will never encounter an incorrect state error.

@malik672
Copy link
Author

malik672 commented Dec 4, 2023

i know though, i'm talking about the error handling itself, won't it just be better to return a custom error to the caller in case the incorrect state ever get's invoked

@prestwich
Copy link
Member

no, the unreachable!() is not handling (or failing to handle) an error, it's communicating to the compiler that the program is incorrect if that line is ever reached

@malik672
Copy link
Author

malik672 commented Dec 5, 2023

oh, thanks

@malik672 malik672 closed this as completed Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants