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

Revisit handling errors and the impact on Optional #44

Closed
keithrfung opened this issue Jun 3, 2020 · 1 comment
Closed

Revisit handling errors and the impact on Optional #44

keithrfung opened this issue Jun 3, 2020 · 1 comment
Labels
question Further information is requested

Comments

@keithrfung
Copy link
Collaborator

Current as defined in the Architecture and Design document, we return Optional to allow returning none and failing quietly. There are numerous sections where this creates convoluted and not clear code. This needs to be revisited and discussed.

One such issue is the use of int_to_q_unchecked and similar functions. These are used frequently and push the issue around of when to return None due to a failure. These would be much clearer with a throw of an Error with a message.

One possible solution is that all global stateless functional methods do not return Optional and stateful classes always return Optional. This would allow for throwing errors at those levels.

@keithrfung keithrfung added the question Further information is requested label Jun 3, 2020
@danwallach
Copy link
Collaborator

The unchecked versions should only be used if you're absolutely certain that there will be no out-of-bounds arguments. Otherwise, use the regular "checked" versions.

I really want to avoid throwing anything. It makes the code much harder to test and debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants