-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Transition): Normalize all transition errors to a Rejection.
BREAKING CHANGE: All Transition errors are now wrapped in a Rejection object. #### Before: Previously, if a transition hook returned a rejected promise: ```js .onStart({}, () => Promise.reject('reject transition')); ``` In `onError` or `transtion.promise.catch()`, the raw rejection was returned: ```js .onError({}, (trans, err) => err === 'reject transition') ``` #### Now: Now, the error is wrapped in a Rejection object. - The detail (thrown error or rejected value) is still available as `.detail`. ```js .onError({}, (trans, err) => err instanceof Rejection && err.detail === 'reject transition') ``` - The Rejection object indicates the `.type` of transition rejection (ABORTED, ERROR, SUPERSEDED and/or redirection). ```js .onError({}, (trans, err) => { err.type === RejectType.ABORTED === 3 }); ``` #### Motivation: Errors *thrown from* a hook and rejection values *returned from* a hook can now be processed in the same way. #### BC Likelihood How likely is this to affect me? Medium: apps which have onError handlers for rejected values #### BC Severity How severe is this change? Low: Find all error handlers (or .catch/.then chains) that do not understand Rejection. Add `err.detail` processing.
- Loading branch information
1 parent
05013a6
commit a7464bb
Showing
4 changed files
with
86 additions
and
62 deletions.
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
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