Invalid options throw a TypeError or RangeError; unknown option names are rejected too.
Optional options: CorjOptionsInputnew Corj.CorjMaker({ maxReportSize: 100 });
// RangeError: maxReportSize must be a safe integer >= 512, or null to disable the limit
Private Readonly ctxReadonly optionsPrivate collectingThe fingerprint alone: discovery and node fields, without as_json, the
context or the limiter. Building no as_json means a caught object whose
.toCorjAsJson() or getters change it as they run can fingerprint
differently here than it does inside a report.
requireStack returns a fingerprint only when fingerprintParts names
stack and the root's stack still carries frames once it has been read and
redacted; anything else is undefined, because a hash of the caught
value's own text is one a reader who can guess that text can confirm.
Optional options: { Optional requiremaker.makeFingerprint(err) === maker.makeFingerprint(err); // true, 'fp1_' + 32 hex characters
maker.makeFingerprint('boom', { requireStack: true }); // undefined: nothing frame-backed to hash
The bounded JSON form of any value, under this maker's inspection and
redact options. A named root such as "$context" starts a separate
document, so a rule written for one never reaches another.
Optional maxOptional root?: stringconst maker = new Corj.CorjMaker({ redact: { keys: ['password'] } });
maker.makeJsonView({ user: 'ada', password: 'p' }, { root: '$request', maxSize: 512 });
// { value: { user: 'ada', password: '[redacted]' }, truncated: false, errors: [] }
The report as one object. Never throws because of caught; an invalid
call input throws a TypeError before any work is done.
Optional call: CorjCallInputconst report = maker.makeReport(caught, { occurrenceId: requestId, context: { route: '/checkout' } });
// { occurrence_id: 'req-42', fingerprint: 'fp1_…', stack: [...], children?: [...], context: {...}, v: 'corj/v0.15' }
The root as the first element followed by every child; nodes link to each other by child_ids.
Optional call: CorjCallInputmaker.makeReportArray(new Error('outer', { cause: new Error('inner') })).map((node) => node.path);
// [ '$', '$.cause' ]
This maker's redact policy applied to one string a consumer emits itself,
such as a log line of its own. Without a policy it is the identity.
Optional path?: stringOptional reportOptional sourceconst maker = new Corj.CorjMaker({ redact: { patterns: [/sk-[a-z0-9]+/g] } });
maker.scrubText('token sk-123 used', { path: '$audit' }); // 'token [redacted] used'
A new maker with these options applied on top of this maker's options. The original is unchanged.
const base = new Corj.CorjMaker({ redact: { keys: ['password'] } });
const forModel = base.withOptions({ maxReportSize: 4096, metadata: false }); // keeps the redact policy
Produces reports with one set of options. Construct once, reuse for every caught object.
Example