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

Add includeFailed to takeWhile #151

Merged
merged 3 commits into from
Jun 7, 2024
Merged

Add includeFailed to takeWhile #151

merged 3 commits into from
Jun 7, 2024

Conversation

kciesielski
Copy link
Member

A useful feature.

@kciesielski kciesielski marked this pull request as ready for review June 5, 2024 13:25
@kciesielski kciesielski requested a review from adamw June 5, 2024 13:25
c.doneOrClosed().discard
false
case ChannelClosed.Error(r) =>
c.errorOrClosed(r).discard
Copy link
Member Author

@kciesielski kciesielski Jun 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Should we ignore if erroring the channel wasn't successful? (here, and in the catch below as well). This is unexpected, but in case of bugs we'd lose the original error. I saw such approach in other ox functions.
Edit:
Following up on this: isn't channel.error(e) problematic in general, because it loses the original e if erroring fails?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the channel is already in an error, the original error will remain. If that's the case, .errorOrClose will return the original one, and do nothing else

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'd lose the original error.
sorry, bad wording, I didn't mean the original error but the "next error". I guess the only alternative is to combine errors, throw and tear down the entire scope, which sounds like a bad idea in this case.

BUT, apart from this case, in case of the channel.error(e) implementation, throwing original error and ignoring e could be improved to throwing original error with e added to its suppressed exceptions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then we could run into concurrency issues. I don't think .addSuppressed is thread-safe?

Copy link
Member

@adamw adamw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for exceptions, looks fine, if you need a release go ahead :)

@kciesielski kciesielski requested a review from adamw June 6, 2024 06:53
@kciesielski kciesielski merged commit 8d48f6d into master Jun 7, 2024
5 checks passed
@kciesielski kciesielski deleted the takewhile-inclusive branch June 7, 2024 06:21
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

Successfully merging this pull request may close these issues.

2 participants