axiom
Version:
Axiom AI SDK provides - an API to wrap your AI calls with observability instrumentation. - offline evals
51 lines (49 loc) • 1.08 kB
JavaScript
import {
init_esm_shims
} from "./chunk-4VNFFUM5.js";
// src/util/errors.ts
init_esm_shims();
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-S65FSMB3.js.map