Skip to content

Commit 8aa1a3b

Browse files
update AutoConfigFrameworkConfigurationError class to extend UserError
1 parent 0c2040e commit 8aa1a3b

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed
Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,7 @@
1-
/**
2-
* This is used to provide telemetry with a sanitised error
3-
* message that could not have any user-identifying information.
4-
* Set to `true` to duplicate `message`.
5-
* */
6-
type TelemetryMessage = {
7-
telemetryMessage?: string | true;
8-
};
1+
import { UserError } from "@cloudflare/workers-utils";
92

103
/**
114
* Base class for errors where something in a autoconfig frameworks' configuration goes
125
* something wrong. These are not reported to Sentry.
136
*/
14-
export class AutoConfigFrameworkConfigurationError extends Error {
15-
telemetryMessage: string | undefined;
16-
constructor(
17-
message?: string | undefined,
18-
options?:
19-
| ({
20-
cause?: unknown;
21-
} & TelemetryMessage)
22-
| undefined
23-
) {
24-
super(message, options);
25-
// Restore prototype chain:
26-
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
27-
Object.setPrototypeOf(this, new.target.prototype);
28-
this.telemetryMessage =
29-
options?.telemetryMessage === true ? message : options?.telemetryMessage;
30-
}
31-
}
7+
export class AutoConfigFrameworkConfigurationError extends UserError {}

0 commit comments

Comments
 (0)