UNPKG

@halsp/core

Version:

面向云的现代渐进式轻量 Node.js 框架

27 lines 750 B
import { isObject, isString } from "./utils/index.mjs"; export function isExceptionMessage(error) { if (!error) return false; return isString(error) || (isObject(error) && !!error.message); } export class HalspException extends Error { error; constructor(error) { super(""); this.error = error; this.name = this.constructor.name; if (isString(error)) { this.message = error; } else if (error && isObject(error)) { this.message = error.message ?? ""; } } inner; breakthrough = false; setBreakthrough(breakthrough = true) { this.breakthrough = breakthrough; return this; } } //# sourceMappingURL=exception.js.map