// Error shaping for `tailor.logger` structured attributes. // // Attribute values must be a string, number, boolean, or same-typed array, so a // thrown value cannot be attached directly — the platform silently drops it. // erp-kit's shared/ layer carries an equivalent helper; modules reach shared // code only through the public `@tailor-platform/erp-kit/core` export, and this // is not worth widening that surface for. import type { LogAttributes } from "@tailor-platform/sdk/runtime/logger"; /** * Split an unknown thrown value into loggable attributes: `error` carries the * message, `errorName` the class name when one is available. */ export function errorAttrs(error: unknown): LogAttributes { if (error instanceof Error) { return { error: error.message, errorName: error.name }; } return { error: String(error) }; }