openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
17 lines (16 loc) • 797 B
JavaScript
import { i as extractErrorCode } from "./error-coercion-D_-xJ90S.js";
import { c as isRecord } from "./record-coerce-DItp3I4t.js";
//#region src/infra/sqlite-error-diagnostics.ts
function formatSqliteErrorCodeSuffix(error) {
const details = /* @__PURE__ */ new Set();
for (let current = error, depth = 0; depth < 8 && isRecord(current); depth += 1) {
const code = extractErrorCode(current);
if (code && /^[A-Z0-9_]{1,64}$/u.test(code)) details.add(`code=${code}`);
const { errcode } = current;
if (typeof errcode === "number" && Number.isInteger(errcode) && errcode >= 0 && errcode <= 2147483647) details.add(`errcode=${errcode}`);
current = current.cause;
}
return details.size > 0 ? ` (${[...details].join(", ")})` : "";
}
//#endregion
export { formatSqliteErrorCodeSuffix as t };