diff --git a/src/cloudflare/internal/workflows-api.ts b/src/cloudflare/internal/workflows-api.ts index 5393bc04452..55a3114710a 100644 --- a/src/cloudflare/internal/workflows-api.ts +++ b/src/cloudflare/internal/workflows-api.ts @@ -3,13 +3,6 @@ // https://opensource.org/licenses/Apache-2.0 export class NonRetryableError extends Error { - // `__brand` is how engine validates that the user returned a `NonRetryableError` - // imported from "cloudflare:workflows" - // This enables them to extend NonRetryableError for their own Errors - // as well by overriding name - // Private fields are not serialized over RPC - public readonly __brand: string = 'NonRetryableError'; - public constructor(message: string, name = 'NonRetryableError') { super(message); this.name = name; diff --git a/types/defines/workflows.d.ts b/types/defines/workflows.d.ts index 6858b5e0fab..db83df77450 100644 --- a/types/defines/workflows.d.ts +++ b/types/defines/workflows.d.ts @@ -1,13 +1,9 @@ -/** - * NonRetryableError allows for a user to throw a fatal error - * that makes a Workflow instance fail immediately without triggering a retry - */ declare module "cloudflare:workflows" { - export abstract class NonRetryableError extends Error { - /** - * `__brand` is used to differentiate between `NonRetryableError` and `Error` - * and is omitted from the constructor because users should not set it - */ + /** + * NonRetryableError allows for a user to throw a fatal error + * that makes a Workflow instance fail immediately without triggering a retry + */ + export class NonRetryableError extends Error { public constructor(message: string, name?: string); } }