UNPKG

jorel

Version:

A unified wrapper for working with LLMs from multiple providers, including streams, images, documents & automatic tool use.

28 lines (27 loc) 895 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.JorElAbortError = void 0; exports.isAbortError = isAbortError; /** * Error thrown when a generation request is cancelled via AbortSignal */ class JorElAbortError extends Error { constructor(message = "Generation was cancelled") { super(message); this.name = "AbortError"; this.code = "GENERATION_ABORTED"; this.isAbortError = true; // Maintains proper stack trace in V8 if (Error.captureStackTrace) { Error.captureStackTrace(this, JorElAbortError); } } } exports.JorElAbortError = JorElAbortError; /** * Type guard to check if an error is an AbortError */ function isAbortError(error) { return (error instanceof JorElAbortError || (error instanceof Error && "isAbortError" in error && error.isAbortError === true)); }