Repository navigation
Add refineOrDie and refineOrDieWith to ZSink - #7165
Merged
adamgfraser merged 6 commits intoAug 3, 2022
Merged
adamgfraser merged 6 commits into
adamgfraser merged 6 commits into
Conversation
adamgfraser
suggested changes
Aug 3, 2022
Contributor
There was a problem hiding this comment.
Looks good. Left a couple of comments below.
| )(f: E => Throwable)(implicit ev: CanFail[E], trace: Trace): ZSink[R, E1, In, L, Z] = | ||
| new ZSink( | ||
| channel.catchAll(e => | ||
| if (pf.isDefinedAt(e)) |
Contributor
There was a problem hiding this comment.
This implementation currently requires potentially evaluating the partialFunction twice (once in isDefinedAt and a second time in apply). We should use another operator here like applyOrElse to avoid this.
Contributor
Author
There was a problem hiding this comment.
Updated here and also for ZStream
|
|
||
| def refineOrDie[E1]( | ||
| pf: PartialFunction[E, E1] | ||
| )(implicit ev1: E <:< Throwable, ev2: CanFail[E], trace: Trace): ZSink[R, E1, In, L, Z] = |
Contributor
There was a problem hiding this comment.
We should use isSubtypeOfError here for improved error messages.
Contributor
Author
There was a problem hiding this comment.
Updated here and also for ZStream
adamgfraser
reviewed
Aug 3, 2022
| def refineOrDie[E1]( | ||
| pf: PartialFunction[E, E1] | ||
| )(implicit ev1: E <:< Throwable, ev2: CanFail[E], trace: Trace): ZStream[R, E1, A] = | ||
| )(implicit ev1: E IsSubtypeOfError Throwable, ev2: CanFail[E], trace: Trace): ZStream[R, E1, A] = |
Contributor
There was a problem hiding this comment.
This change is not going to be binary compatible.
adamgfraser
approved these changes
Aug 3, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.