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

Suggest fixes to onError + as usage #332

Open
paulpdaniels opened this issue Oct 31, 2021 · 0 comments
Open

Suggest fixes to onError + as usage #332

paulpdaniels opened this issue Oct 31, 2021 · 0 comments

Comments

@paulpdaniels
Copy link

onError looks like onErrorHandle from monix but has a different behavior. However, the signature of onError can make it difficult detect this bug.

Consider:

val e1 = effect.onError(e => log.info("Ok got it $e"))

If e1 is paired with another effect that has an error channel it will unify and it won't be clear to the user that this isn't actually handling the error. However, if this is paired with an operator like as or orElseSucceed, then we can infer that the user either misunderstands onError or could simplify by removing the as since it won't actually do anything.

i.e.

// They either want to use `catch*` or they can just remove the `as`.
val e1 = effect.onError(e => log.info("Ok got it $e") as 42)
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