feat: add action failure helper - #12878
Conversation
🦋 Changeset detectedLatest commit: ac9a325 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| * Checks whether this is an action failure thrown by {@link fail}. | ||
| * @param e The object to check. | ||
| * */ | ||
| export function isActionFailure(e: unknown): e is ActionFailure_1<undefined>; |
There was a problem hiding this comment.
Through this I'm realizing just now that we're not returning "is this interface" but rather "is this class" from that. We should definitely change it for the new function to refer to the interface instead, not sure if it's seen as a breaking change to change it for the others, too
There was a problem hiding this comment.
Do you mean we should change them to not use instanceof for the check? Or simply changing the return type to use the interface:
/**
* Checks whether this is an action failure thrown by {@link fail}.
* @param {unknown} e The object to check.
- * @return {e is ActionFailure}
+ * @return {e is import('./public.js').ActionFailure}
*/
export function isActionFailure(e) {
return e instanceof ActionFailure;
}It would be a breaking change for the other helpers I think.
There was a problem hiding this comment.
If there's a breaking change we want to eventually make for the others, can you file an issue and add it to the 3.0 milestone so that we don't forget?
closes #12611
Exposes a helper method to check if a variable is an instanceof
ActionFailurePlease don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.Edits