-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b8f52d
commit 3fe32c6
Showing
3 changed files
with
21 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
export class NonRetryableError extends Error { | ||
// `__brand` is needed for Workflows' engine to validate if the user returned a NonRetryableError | ||
// this provides better DX because they can just extend NonRetryableError for their own Errors | ||
public readonly __brand: string = "NonRetryableError" | ||
|
||
public constructor(message: string, name = "NonRetryableError") { | ||
super(message); | ||
this.name = name; | ||
} | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { NonRetryableError } from "cloudflare-internal:workflows-api" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
/** | ||
* NonRetryableError allows for a Workflow to throw a "fatal" error as in, | ||
* an error that makes the instance fail immediately without triggering a retry. | ||
*/ | ||
export class NonRetryableError extends Error { | ||
public constructor(message: string, name?: string); | ||
} |