attributes(failure: Any): TraceAttributes
Span/log attributes a failure declares for tracing: failure.code plus whatever its
factory's trace mapper (see define) explicitly allowlisted from data. A
failure whose factory declared no mapper yields the code alone — unmapped payload
fields never leave the process, which is what makes redaction (passwords, tokens) the
default rather than a discipline.
Keyed by code, so it also works on failures that crossed a realm or a fromJSON revive.
import * as Failure from './failure.ts'; const AuthFailed = Failure.define( 'AuthFailed', (d: { status: number; password: string }) => `auth rejected: HTTP ${d.status}`, { trace: (d) => ({ 'auth.status': d.status }) }, ); Failure.attributes(AuthFailed({ status: 401, password: 'hunter2' })); // { 'failure.code': 'AuthFailed', 'auth.status': 401 } — the password cannot leak: never mapped
failure: Any