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

Move from Try to Either #14

Open
bblfish opened this issue Nov 29, 2022 · 2 comments
Open

Move from Try to Either #14

bblfish opened this issue Nov 29, 2022 · 2 comments

Comments

@bblfish
Copy link
Owner

bblfish commented Nov 29, 2022

The problem with Try is that it does not make explicit the type of errors that should be expected from a function. All the code in httpSig has an upper set of exceptions to be expected, and this should be made visible. It would also work better with other cats libs.
Try was a way to get things done quickly.

@bblfish
Copy link
Owner Author

bblfish commented Nov 29, 2022

It can be done nicely, but it gets a bit problematic with RFC8941 code which throws
exceptions (eg on Token creation(, in order to reduce the need for flatmaps everywhere. This is certainly where canthrow experimental feature could come in useful
https://docs.scala-lang.org/scala3/reference/experimental/canthrow.html

bblfish added a commit that referenced this issue Nov 29, 2022
@bblfish
Copy link
Owner Author

bblfish commented Nov 30, 2022

Most of the migration was done in previious commit.
But if we don't allow exceptions to be thrown for simple Token creations then it really coud make using the code a bit difficult. So the can throw stuff needs to be looked at.

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

No branches or pull requests

1 participant