-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): errored initial snapshot throws sync w/o observers
This modifies the error-handling logic for when an error is thrown during the creation of an Actor's initial snapshot (during `start()`). _If_ the actor has _no_ observers, the error will now be thrown synchronously out of `start()` instead of to the global error handler. Example use case: ```js const machine = createMachine({ context: () => { throw new Error('egad!'); } }); const actor = createActor(machine); try { await toPromise(actor.start()); } catch (err) { err.message === 'egad!' // true } ``` Note that this _does not impact child actors_. Fixes: #4928
- Loading branch information
Showing
2 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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