UNPKG

axiom

Version:

Axiom AI SDK provides - an API to wrap your AI calls with observability instrumentation. - offline evals - online evals

46 lines (45 loc) 1.01 kB
// src/util/errors.ts var AxiomCLIError = class extends Error { constructor(message) { super(message); this.name = "AxiomCLIError"; } }; function getCircularReplacer() { const seen = /* @__PURE__ */ new WeakSet(); return (_k, v) => { if (typeof v === "object" && v !== null) { if (seen.has(v)) return "[Circular]"; seen.add(v); } return v; }; } function safeJson(x) { try { return JSON.stringify(x, getCircularReplacer()); } catch { return String(x); } } function errorToString(err) { try { if (typeof err === "string") return err; if (err instanceof Error) { return err.stack ?? err.message; } if (typeof err === "object" && err !== null) { const msg = err.message; const json = safeJson(err); return msg ? `${msg} (${json})` : json; } return String(err); } catch { return "[unserializable error]"; } } export { AxiomCLIError, errorToString }; //# sourceMappingURL=chunk-ISSDOC43.js.map