Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DefaultonError for invoked actors#5195

Unanswered
crishoj asked this question inIdeas
Feb 12, 2025· 1 comments· 1 reply
Discussion options

I find myself repeatingonError attributes in machines with lots of invoked actors.

Would it be crazy to allow a "default"onError to be specified inStateNodeConfig?

createMachine({initial:'running',states:{running:{onError:'failed',// 👈 This is what I would like to dostates:{idle:{invoke:{src:'someService',onDone:'processing'}},processing:{invoke:{src:'someOtherService',onDone:'success'}},success:{}}},failed:{// From here we could resume to a history state}}})

Invoked actors within therunning state could use the defaultonError transition, if they don't specify their ownonError transition.

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

This is a good idea. Might not really be type-safe, since it's hard to predict which invokes it's for, and ideally this can be used for any error that happens in the state.

You must be logged in to vote
1 reply
@Hebilicious
Comment options

I like this idea, and I would also like foronError to catchall errors that happens, not just errors that happens in the invoked actor. ie, catch synchronous errors from actions and inputs as well.
See#5271 (comment)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Ideas
Labels
None yet
3 participants
@crishoj@davidkpiano@Hebilicious

[8]ページ先頭

©2009-2025 Movatter.jp