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

How to call untyped errors #40

Closed
Avasil opened this issue Dec 10, 2019 · 7 comments
Closed

How to call untyped errors #40

Avasil opened this issue Dec 10, 2019 · 7 comments
Labels
discussion help wanted Extra attention is needed
Milestone

Comments

@Avasil
Copy link
Contributor

Avasil commented Dec 10, 2019

There are two channels of errors in Bifunctor implementations:

  • "Typed" errors which are part of the type signature and most error handling operators should work on this kind of errors
  • Untyped / fatal / defects / unrecoverable errors which are hidden from the signature and generally these are exceptions like RejectedExecutionException and everything that we don't care about in the signature.

I'm not sure how to call the latter, right now I use "fatal" which is kind of accurate but I'm worried about confusion with scala.util.control.NonFatal and really fatal errors like OutOfMemoryError

@Avasil Avasil added help wanted Extra attention is needed discussion labels Dec 10, 2019
@xplosunn
Copy link
Contributor

I suggest Unexpected.

@Avasil
Copy link
Contributor Author

Avasil commented Dec 12, 2019

I suggest Unexpected.

I think Unexpected is good in docs but I've forgotten to mention that I'm looking for something to use in method names, i.e. raiseFatalError, redeemFatalWith etc. Although if we stay with Cause and do redeemCauseWith (similar to ZIO naming with foldCauseM) for cases which handle both cases and raiseUnexpectedError, onUnexpectedError it might be decent. Thanks for suggestion!

@pjurczenko
Copy link
Contributor

What do you think about "terminal errors"?

@Avasil Avasil added this to the 0.1.0 milestone Jan 11, 2020
@Avasil
Copy link
Contributor Author

Avasil commented Feb 20, 2020

I'm working on a PR which aims to more or less finalize error handling for 0.1.0 and this matter came back to me

@pjurczenko

What do you think about "terminal errors"?

I didn't like it when I first read it because I was too concerned about naming consistency with raiseError but now that I'm thinking - it could be pretty good if we go for BIO#terminate instead of BIO#raiseFatalError.

Overall naming consistency is pretty big priority to me but I don't think we should worry about it too much in the case of this error channel.

WDYT?

@alexandru
Copy link
Member

@Avasil not sure what you're thinking of, but "untyped errors" already have a standard and pretty clear name imo — exceptions 🙂

@Avasil
Copy link
Contributor Author

Avasil commented Feb 21, 2020

@alexandru
I feel like having both raiseError and raiseException or something along these lines could be pretty confusing :D

In discussions about Bifunctor I often see that errors in Bifunctor IO are called "typed" (reflected in the type signature) and Monofunctor IO has "untyped" errors.

Of course BIO having all errors represented in the type signature is an illusion and there is also hidden "untyped" error channel which needs at least a small amount of separate combinators.

The idea is that these unexpected errors are not something the user either cannot handle or can only handle at the edges of the program and it skips most error handling combinators.

I also extended Callback to have onFatalError along with onSuccess and onError and I need to find a proper name for onFatalError (or decide to keep that one)

@Avasil Avasil modified the milestones: 0.1.0, 1.0.0 Feb 22, 2020
@pjurczenko
Copy link
Contributor

@Avasil BIO#terminate sounds good to me. It fits really well with that "terminal error" naming. I also like the fact that the names would be similar to the ones in Izumi. This will be less confusing for the end users, especially the ones using Izumi typeclasses with BIO datatype (which will be possible I believe).

@Avasil Avasil closed this as completed Jun 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants