happy-server/sources/utils/aborted.ts
2025-07-26 01:16:22 -07:00

15 lines
462 B
TypeScript

export class AbortedExeption extends Error {
constructor(message: string = "Operation aborted") {
super(message);
this.name = "AbortedExeption";
// This is needed to properly capture the stack trace in TypeScript
if (Error.captureStackTrace) {
Error.captureStackTrace(this, AbortedExeption);
}
}
static isAborted(error: unknown): boolean {
return error instanceof AbortedExeption;
}
}