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 SuspendAction to create an action from a suspend function #408

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mattkranzler5
Copy link
Contributor

No description provided.

@mattkranzler5 mattkranzler5 requested a review from Laimiux January 24, 2025 19:32
@carrotkite
Copy link

1 Warning
⚠️ No coverage data found for com/instacart/formula/coroutines/SuspendAction

JaCoCo Code Coverage 96.48% ✅

Class Covered Meta Status
com/instacart/formula/coroutines/SuspendAction No coverage data found : -% No coverage data found : -% 🃏

Generated by 🚫 Danger

*/
fun <Event> from(
create: suspend () -> Event
): SuspendAction<Event> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it should be Result<Error> to ensure that we emit errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you mean Result<Event>, but shouldn't exception handling be up to the consumer? The consumer can handle wrapping their function in a try/catch and return a Result if they would like, but I'm not sure requiring that should be necessary. How do FlowAction and RxAction handle errors? It looks to me like unhandled errors in the stream would result in a crash.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's a good callout, I need to think about it more globally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems like having an api (onError()) on ActionBuilder might be a good idea.

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.

3 participants