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ACrB,EAAE,EAAE,eAAe;gBACnB,KAAK,EAAE,EAAE;gBACT,IAAI,EAAE,mBAAmB;gBACzB,IAAI,EAAE,KAAK;gBACX,MAAM,EAAE,IAAI;aACb;SACF,CAAA;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,GAAY;IAC1C,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;IAE9B,IAAI,GAAG,GAAG,MAAM,EAAE,OAAO,IAAI,OAAO,CAAA;IAEpC,IAAI,MAAM,EAAE,KAAK,EAAE,CAAC;QAClB,GAAG,IAAI,gBAAgB,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAA;IACxD,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9D,GAAG,IAAI,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3E,CAAC;IAED,8EAA8E;IAC9E,4EAA4E;IAC5E,IAAI,OAAO,eAAe,KAAK,WAAW,IAAI,MAAM,YAAY,eAAe,EAAE,CAAC;QAChF,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,GAAG,IAAI,YAAY,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAA;QACpD,CAAC;QACD,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,GAAG,IAAI,iBAAiB,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAA;QAC9D,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"} |
+59
-43
@@ -1,50 +0,66 @@ | ||
| export class AbortError extends Error { | ||
| constructor(message: string) | ||
| export declare const SIGNALS: Readonly<Record<number, string>>; | ||
| export declare class AbortError extends Error { | ||
| code: 'ABORT_ERR'; | ||
| name: 'AbortError'; | ||
| constructor(message?: string, options?: { | ||
| cause?: unknown; | ||
| }); | ||
| } | ||
| type Falsy = false | 0 | 0n | '' | null | undefined | ||
| export function parseError<Err>(err: Err): Err extends Falsy ? null : Error & NxtError | ||
| type Falsy = false | 0 | 0n | '' | null | undefined; | ||
| export interface NxtError { | ||
| message: string | ||
| type?: string | ||
| code?: string | ||
| exitCode?: number | ||
| signalCode?: number | ||
| statusCode?: number | ||
| headers?: Record<string, string> | ||
| data?: object | ||
| cause?: NxtError | null | ||
| errors?: NxtError[] | null | ||
| error?: NxtError[] | null | ||
| suppressed?: NxtError[] | null | ||
| message: string; | ||
| type?: string; | ||
| code?: string; | ||
| exitCode?: number; | ||
| signalCode?: number | string; | ||
| statusCode?: number; | ||
| headers?: Record<string, string>; | ||
| data?: unknown; | ||
| cause?: NxtError[]; | ||
| errors?: NxtError[]; | ||
| error?: NxtError[]; | ||
| suppressed?: NxtError[]; | ||
| } | ||
| type SerializableError = null | undefined | Error | string | NxtError | SerializableError[] | ||
| export function serializeError(err: unknown): NxtError[] | null | ||
| export interface ParsedError extends Error { | ||
| type?: unknown; | ||
| code?: unknown; | ||
| data?: unknown; | ||
| cause?: ParsedError | null; | ||
| errors?: unknown; | ||
| error?: unknown; | ||
| suppressed?: unknown; | ||
| } | ||
| export declare function parseError<Err>(err: Err): Err extends Falsy ? null : Err extends Error ? ParsedError : ParsedError | null; | ||
| export declare function serializeError(error: unknown): NxtError[] | null; | ||
| export interface Message { | ||
| msg: string | ||
| title?: string | ||
| id: string | ||
| level: number | ||
| code?: string | ||
| data?: object | ||
| expose?: boolean | null | ||
| index?: object | null | ||
| msg: string; | ||
| title?: string; | ||
| id: string; | ||
| level: number; | ||
| code?: string; | ||
| data?: unknown; | ||
| expose?: boolean | null; | ||
| index?: object | null; | ||
| } | ||
| export interface MessageOptions { | ||
| id?: string | ||
| level?: number | ||
| code?: string | ||
| codes?: Record<string, string> | ||
| index?: boolean | ||
| id?: string; | ||
| level?: number; | ||
| code?: string; | ||
| codes?: Record<string, string>; | ||
| index?: boolean; | ||
| } | ||
| export type MessageError = Array<Message | SerializableError> | Message | SerializableError | ||
| export function makeMessages(error: MessageError, options?: MessageOptions): Message[] | ||
| export function makeErrorString(err: unknown): string | ||
| export interface MessageInput { | ||
| msg?: string; | ||
| message?: string; | ||
| level?: number | string; | ||
| code?: string; | ||
| id?: string; | ||
| data?: unknown; | ||
| [key: string]: unknown; | ||
| } | ||
| type SerializableError = null | undefined | Error | string | NxtError | SerializableError[]; | ||
| export type MessageError = Array<Message | MessageInput | SerializableError> | Message | MessageInput | SerializableError; | ||
| export declare function makeMessages(error: MessageError, options?: MessageOptions): Message[]; | ||
| export declare function makeErrorString(err: unknown): string; | ||
| export {}; | ||
| //# sourceMappingURL=index.d.ts.map |
+450
-373
@@ -1,400 +0,477 @@ | ||
| import objectHash from 'object-hash' | ||
| import fp from 'lodash/fp.js' | ||
| export const SIGNALS = | ||
| typeof process === 'object' | ||
| import objectHash from 'object-hash'; | ||
| import fp from 'lodash/fp.js'; | ||
| export const SIGNALS = typeof process === 'object' | ||
| ? process.platform === 'linux' | ||
| ? { | ||
| 129: 'SIGHUP', // 1 | ||
| 130: 'SIGINT', // 2 | ||
| 131: 'SIGQUIT', // 3 | ||
| 132: 'SIGILL', // 4 | ||
| 133: 'SIGTRAP', // 5 | ||
| 134: 'SIGABRT', // 6 | ||
| 135: 'SIGBUS', // 7 | ||
| 136: 'SIGFPE', // 8 | ||
| 137: 'SIGKILL', // 9 | ||
| 138: 'SIGUSR1', // 10 | ||
| 139: 'SIGSEGV', // 11 | ||
| 140: 'SIGUSR2', // 12 | ||
| 141: 'SIGPIPE', // 13 | ||
| 142: 'SIGALRM', // 14 | ||
| 143: 'SIGTERM', // 15 | ||
| 144: 'SIGSTKFLT', // 16 | ||
| 145: 'SIGCHLD', // 17 | ||
| 146: 'SIGCONT', // 18 | ||
| 147: 'SIGSTOP', // 19 | ||
| 148: 'SIGTSTP', // 20 | ||
| 149: 'SIGTTIN', // 21 | ||
| 150: 'SIGTTOU', // 22 | ||
| 151: 'SIGURG', // 23 | ||
| 152: 'SIGXCPU', // 24 | ||
| 153: 'SIGXFSZ', // 25 | ||
| 154: 'SIGVTALRM', // 26 | ||
| 155: 'SIGPROF', // 27 | ||
| 156: 'SIGWINCH', // 28 | ||
| 157: 'SIGIO', // 29 | ||
| 158: 'SIGPWR', // 30 | ||
| 159: 'SIGSYS', // 31 | ||
| ? { | ||
| 129: 'SIGHUP', // 1 | ||
| 130: 'SIGINT', // 2 | ||
| 131: 'SIGQUIT', // 3 | ||
| 132: 'SIGILL', // 4 | ||
| 133: 'SIGTRAP', // 5 | ||
| 134: 'SIGABRT', // 6 | ||
| 135: 'SIGBUS', // 7 | ||
| 136: 'SIGFPE', // 8 | ||
| 137: 'SIGKILL', // 9 | ||
| 138: 'SIGUSR1', // 10 | ||
| 139: 'SIGSEGV', // 11 | ||
| 140: 'SIGUSR2', // 12 | ||
| 141: 'SIGPIPE', // 13 | ||
| 142: 'SIGALRM', // 14 | ||
| 143: 'SIGTERM', // 15 | ||
| 144: 'SIGSTKFLT', // 16 | ||
| 145: 'SIGCHLD', // 17 | ||
| 146: 'SIGCONT', // 18 | ||
| 147: 'SIGSTOP', // 19 | ||
| 148: 'SIGTSTP', // 20 | ||
| 149: 'SIGTTIN', // 21 | ||
| 150: 'SIGTTOU', // 22 | ||
| 151: 'SIGURG', // 23 | ||
| 152: 'SIGXCPU', // 24 | ||
| 153: 'SIGXFSZ', // 25 | ||
| 154: 'SIGVTALRM', // 26 | ||
| 155: 'SIGPROF', // 27 | ||
| 156: 'SIGWINCH', // 28 | ||
| 157: 'SIGIO', // 29 | ||
| 158: 'SIGPWR', // 30 | ||
| 159: 'SIGSYS', // 31 | ||
| } | ||
| : {} | ||
| : {} | ||
| const { toString } = Object.prototype | ||
| : {} | ||
| : {}; | ||
| export class AbortError extends Error { | ||
| constructor(message) { | ||
| super(message ?? 'The operation was aborted') | ||
| this.code = 'ABORT_ERR' | ||
| this.name = 'AbortError' | ||
| } | ||
| constructor(message, options) { | ||
| super(message ?? 'The operation was aborted', options); | ||
| this.code = 'ABORT_ERR'; | ||
| this.name = 'AbortError'; | ||
| } | ||
| } | ||
| export function parseError(error) { | ||
| if (!error) { | ||
| return null | ||
| } | ||
| if (typeof error === 'string') { | ||
| error = { message: error } | ||
| } | ||
| if (Array.isArray(error)) { | ||
| const errors = error.map(parseError).filter(Boolean) | ||
| return errors.length === 0 ? null : errors.length === 1 ? errors[0] : new AggregateError(errors) | ||
| } | ||
| const { msg, message = msg, errors, cause, data, ...properties } = error | ||
| // SuppressedError (explicit resource management): rebuild a real instance, | ||
| // mirroring the AggregateError branch. Detect a live instance, a serialized | ||
| // one (`type`), or a name match — not a stray `suppressed` field on an | ||
| // unrelated object. `error`/`suppressed` are reconstructed into the instance | ||
| // itself, so drop them from the copied-over properties (they are enumerable in | ||
| // the serialized form; non-enumerable on a live instance). | ||
| if ( | ||
| typeof SuppressedError !== 'undefined' && | ||
| (error instanceof SuppressedError || | ||
| error.type === 'SuppressedError' || | ||
| error.name === 'SuppressedError') | ||
| ) { | ||
| delete properties.error | ||
| delete properties.suppressed | ||
| return Object.assign( | ||
| new SuppressedError(parseError(error.error), parseError(error.suppressed), message ?? ''), | ||
| { | ||
| ...properties, | ||
| cause: cause ? parseError(cause) : undefined, | ||
| data, | ||
| }, | ||
| ) | ||
| } | ||
| return Object.assign( | ||
| Array.isArray(errors) | ||
| ? // Filter falsy results, matching the top-level array branch above: a | ||
| // falsy entry would otherwise become a literal `null` inside the | ||
| // constructed AggregateError's `errors`. | ||
| new AggregateError(errors.map(parseError).filter(Boolean), message) | ||
| : new Error(message || 'unknown error'), | ||
| { | ||
| ...properties, | ||
| cause: cause ? parseError(cause) : undefined, | ||
| data, | ||
| }, | ||
| ) | ||
| return _parseError(error, { depth: 0, seen: new WeakSet() }); | ||
| } | ||
| const kSeen = Symbol('kSeen') | ||
| function _parseError(error, ctx) { | ||
| if (!error) { | ||
| return null; | ||
| } | ||
| if (typeof error === 'string') { | ||
| error = { message: error }; | ||
| } | ||
| // Serialized errors are acyclic and depth-capped, but live error graphs and | ||
| // hostile JSON bodies are not: a circular cause or a deeply nested chain must | ||
| // not stack-overflow. Mirrors _serializeError's kSeen marker + depth cap. | ||
| if (ctx.depth > 8) { | ||
| return new Error('Maximum error parse depth exceeded'); | ||
| } | ||
| if (typeof error === 'object' && error !== null) { | ||
| if (ctx.seen.has(error)) { | ||
| return null; | ||
| } | ||
| ctx.seen.add(error); | ||
| } | ||
| try { | ||
| if (Array.isArray(error)) { | ||
| const errors = error | ||
| .map((x) => _parseError(x, { depth: ctx.depth + 1, seen: ctx.seen })) | ||
| .filter((x) => x != null); | ||
| return errors.length === 0 | ||
| ? null | ||
| : errors.length === 1 | ||
| ? errors[0] | ||
| : new AggregateError(errors); | ||
| } | ||
| const { msg, message = msg, errors, cause, data, ...properties } = error; | ||
| // JSON.parse creates '__proto__' as an own data property; Object.assign | ||
| // would copy it via [[Set]] and silently replace the reconstructed error's | ||
| // prototype (the result would no longer be instanceof Error). Strip it. | ||
| delete properties['__proto__']; | ||
| // SuppressedError (explicit resource management): rebuild a real instance, | ||
| // mirroring the AggregateError branch. Detect a live instance, a serialized | ||
| // one (`type`), or a name match — not a stray `suppressed` field on an | ||
| // unrelated object. `error`/`suppressed` are reconstructed into the instance | ||
| // itself, so drop them from the copied-over properties (they are enumerable in | ||
| // the serialized form; non-enumerable on a live instance). | ||
| if (typeof SuppressedError !== 'undefined' && | ||
| (error instanceof SuppressedError || | ||
| error.type === 'SuppressedError' || | ||
| error.name === 'SuppressedError')) { | ||
| delete properties.error; | ||
| delete properties.suppressed; | ||
| return Object.assign(new SuppressedError(_parseError(error.error, { depth: ctx.depth + 1, seen: ctx.seen }), _parseError(error.suppressed, { depth: ctx.depth + 1, seen: ctx.seen }), (message ?? '')), { | ||
| ...properties, | ||
| cause: cause ? _parseError(cause, { depth: ctx.depth + 1, seen: ctx.seen }) : undefined, | ||
| data, | ||
| }); | ||
| } | ||
| if (errors != null && !Array.isArray(errors)) { | ||
| // A truthy non-array `errors` value is not an aggregate; keep it as a | ||
| // plain property instead of silently dropping it. | ||
| properties.errors = errors; | ||
| } | ||
| return Object.assign(Array.isArray(errors) | ||
| ? // Filter falsy results, matching the top-level array branch above: a | ||
| // falsy entry would otherwise become a literal `null` inside the | ||
| // constructed AggregateError's `errors`. | ||
| new AggregateError(errors | ||
| .map((x) => _parseError(x, { depth: ctx.depth + 1, seen: ctx.seen })) | ||
| .filter((x) => x != null), message) | ||
| : // `??`, not `||`: a deliberate empty-string message must survive the | ||
| // round trip; only a missing message falls back. | ||
| new Error((message ?? 'unknown error')), { | ||
| ...properties, | ||
| cause: cause ? _parseError(cause, { depth: ctx.depth + 1, seen: ctx.seen }) : undefined, | ||
| data, | ||
| }); | ||
| } | ||
| finally { | ||
| if (typeof error === 'object' && error !== null) { | ||
| ctx.seen.delete(error); | ||
| } | ||
| } | ||
| } | ||
| const kSeen = Symbol('kSeen'); | ||
| function isSignalName(signal) { | ||
| return typeof signal === 'string' && /^SIG[A-Z0-9]+$/.test(signal); | ||
| } | ||
| function hasEntries(value) { | ||
| return (value != null && | ||
| !Array.isArray(value) && | ||
| typeof value.entries === 'function'); | ||
| } | ||
| // JSON.stringify replacer used for the final serialization pass. It | ||
| // (1) stringifies bigints, (2) serializes Error instances reachable through | ||
| // arbitrary properties — they have no enumerable own fields and would | ||
| // otherwise collapse to {} — and (3) prunes true cycles (an ancestor | ||
| // reappearing below itself) while keeping legitimate DAG-shared references, | ||
| // with a generous nesting cap so a pathological payload cannot overflow the | ||
| // stack. The kSeen/depth guards only cover the cause/errors graph; anything | ||
| // reachable via `...properties`, `data`, or `headers` lands here unguarded. | ||
| function makeReplacer(depth) { | ||
| const ancestors = []; | ||
| return function (key, value) { | ||
| if (typeof value === 'bigint') { | ||
| return value.toString(); | ||
| } | ||
| if (typeof value !== 'object' || value === null) { | ||
| return value; | ||
| } | ||
| while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) { | ||
| ancestors.pop(); | ||
| } | ||
| if (ancestors.includes(value) || ancestors.length > 64) { | ||
| return undefined; | ||
| } | ||
| if (value instanceof Error) { | ||
| const serialized = _serializeError(value, { depth: depth + 1 }); | ||
| if (!serialized) { | ||
| return undefined; | ||
| } | ||
| ancestors.push(serialized); | ||
| return serialized; | ||
| } | ||
| ancestors.push(value); | ||
| return value; | ||
| }; | ||
| } | ||
| export function serializeError(error) { | ||
| return _serializeError(error, { depth: 0 }) | ||
| return _serializeError(error, { depth: 0 }); | ||
| } | ||
| function _serializeError(error, { depth }) { | ||
| if (!error) { | ||
| return null | ||
| } | ||
| if (typeof error === 'string') { | ||
| return [_serializeError({ message: error }, { depth })].flat() | ||
| } | ||
| if (Buffer.isBuffer(error)) { | ||
| return null | ||
| } | ||
| if (depth > 8) { | ||
| return [{ message: 'Maximum error serialization depth exceeded' }] | ||
| } | ||
| if (Array.isArray(error)) { | ||
| const errors = error.flatMap((x) => _serializeError(x, { depth: depth + 1 })).filter(Boolean) | ||
| return errors.length === 0 ? null : errors | ||
| } | ||
| if (Object.prototype.hasOwnProperty.call(error, kSeen)) { | ||
| return null | ||
| } | ||
| error[kSeen] = undefined | ||
| try { | ||
| const type = | ||
| typeof error?.type === 'string' && fp.isPlainObject(error) | ||
| ? error.type | ||
| : toString.call(error.constructor) === '[object Function]' | ||
| ? error.constructor.name | ||
| : error.name | ||
| // Use `??`, NOT `||`: a primitive `data` of 0/false/'' is a valid value and | ||
| // must not fall through to `error.body` (the line-214 `== null` gate below | ||
| // is otherwise never reached for it). Completes the fix in 7ce9ddbe. | ||
| let data = error.data ?? error.body | ||
| if (typeof data === 'string') { | ||
| try { | ||
| data = JSON.parse(data) | ||
| } catch { | ||
| // Do nothing... | ||
| } | ||
| if (!error) { | ||
| return null; | ||
| } | ||
| let { | ||
| msg, | ||
| message = msg, | ||
| code, | ||
| // Only coerce a code/signal that is already a *number*. A numeric-looking | ||
| // *string* code — e.g. a pg SQLSTATE `'23505'` — is not a process exit | ||
| // code, but `Number('23505')` is a valid integer that used to be emitted | ||
| // as a bogus `exitCode`. A child-process exit code arrives as a number; a | ||
| // signal is usually a string name and only yields a `signalCode` when it | ||
| // is itself numeric. | ||
| exitCode = typeof code === 'number' ? code : undefined, | ||
| signal, | ||
| signalCode = typeof signal === 'number' ? signal : undefined, | ||
| body, | ||
| status, | ||
| statusCode = status, | ||
| headers, | ||
| ...properties | ||
| } = error | ||
| if (typeof message !== 'string') { | ||
| message = undefined | ||
| if (typeof error === 'string') { | ||
| return _serializeError({ message: error }, { depth }); | ||
| } | ||
| if (!Number.isInteger(exitCode)) { | ||
| exitCode = undefined | ||
| // Truthy non-object values (numbers, booleans, bigints, symbols) cannot carry | ||
| // the kSeen marker — the strict-mode write below would throw. `throw 42` and | ||
| // `cause: 42` are legal JS; represent them as their string form. | ||
| if (typeof error === 'number' || | ||
| typeof error === 'boolean' || | ||
| typeof error === 'bigint' || | ||
| typeof error === 'symbol') { | ||
| return [{ message: typeof error === 'symbol' ? error.toString() : String(error) }]; | ||
| } | ||
| if (!Number.isInteger(signalCode)) { | ||
| signalCode = undefined | ||
| if (typeof Buffer !== 'undefined' && Buffer.isBuffer(error)) { | ||
| return null; | ||
| } | ||
| if (!Number.isInteger(statusCode)) { | ||
| statusCode = undefined | ||
| if (depth > 8) { | ||
| return [{ message: 'Maximum error serialization depth exceeded' }]; | ||
| } | ||
| if (!fp.isPlainObject(headers)) { | ||
| headers = undefined | ||
| if (Array.isArray(error)) { | ||
| const errors = error | ||
| .flatMap((x) => _serializeError(x, { depth: depth + 1 })) | ||
| .filter((x) => x != null); | ||
| return errors.length === 0 ? null : errors; | ||
| } | ||
| if (typeof signal === 'number') { | ||
| signal = SIGNALS[signal] ?? signal | ||
| const err = error; | ||
| if (Object.prototype.hasOwnProperty.call(err, kSeen)) { | ||
| return null; | ||
| } | ||
| if (typeof signalCode === 'number') { | ||
| signalCode = SIGNALS[signalCode] ?? signalCode | ||
| // A frozen/sealed error cannot take the marker (strict mode would throw). | ||
| // Skipping the stamp only weakens cycle detection through that object — the | ||
| // depth cap still bounds the recursion, and the finally-delete of a | ||
| // non-existent property is a no-op even on a frozen object. | ||
| if (Object.isExtensible(err)) { | ||
| err[kSeen] = undefined; | ||
| } | ||
| const errors = [error.errors, error.aggregateErrors] | ||
| .flat(Infinity) | ||
| .filter(Boolean) | ||
| .flatMap((x) => _serializeError(x, { depth: depth + 1 })) | ||
| .filter(Boolean) | ||
| const cause = error.cause ? _serializeError(error.cause, { depth: depth + 1 }) : undefined | ||
| // SuppressedError (explicit resource management): `error` (the failure that | ||
| // superseded) and `suppressed` (the earlier, hidden failure) are | ||
| // non-enumerable own properties, so they never reach `...properties` and | ||
| // must be pulled out and serialized explicitly. Gate on the type so an | ||
| // unrelated `error`/`suppressed` field on a plain object is left untouched | ||
| // in `...properties`. | ||
| const primary = | ||
| type === 'SuppressedError' && error.error | ||
| ? _serializeError(error.error, { depth: depth + 1 }) | ||
| : undefined | ||
| const suppressed = | ||
| type === 'SuppressedError' && error.suppressed | ||
| ? _serializeError(error.suppressed, { depth: depth + 1 }) | ||
| : undefined | ||
| return [ | ||
| JSON.parse( | ||
| JSON.stringify( | ||
| { | ||
| ...properties, | ||
| message: message ?? 'Unknown error', | ||
| type: type !== 'Object' ? type : undefined, | ||
| // Gate on `== null`, NOT fp.isEmpty: `fp.isEmpty(<any number>)` is | ||
| // always true, so a numeric `code` (e.g. 500) was silently dropped | ||
| // here — same foot-gun documented below for exit/signal/statusCode. | ||
| code: code == null ? undefined : `${code}`, | ||
| // NOTE: exitCode/signalCode/statusCode are validated integers (or, | ||
| // for signalCode, a mapped signal-name string) above. They must be | ||
| // gated on `== null`, NOT fp.isEmpty: `fp.isEmpty(<any number>)` is | ||
| // always true, so using it here silently dropped every numeric | ||
| // status/exit/signal code from the serialized error. | ||
| exitCode: exitCode == null ? undefined : exitCode, | ||
| signalCode: signalCode == null ? undefined : signalCode, | ||
| statusCode: statusCode == null ? undefined : statusCode, | ||
| headers: fp.isEmpty(headers) ? undefined : headers, | ||
| // Gate on `== null`, NOT fp.isEmpty: `fp.isEmpty(<any number>)` is | ||
| // always true, so a primitive `data` (e.g. 0, 500, false, or a | ||
| // numeric JSON string) was silently dropped here — same foot-gun | ||
| // documented above for the code/exit/signal/status fields. | ||
| data: data == null ? undefined : data, | ||
| cause: fp.isEmpty(cause) ? undefined : cause, | ||
| errors: fp.isEmpty(errors) ? undefined : errors, | ||
| // Only emit these for a genuine SuppressedError; adding them | ||
| // unconditionally would clobber an unrelated object's own | ||
| // `error`/`suppressed` field (carried in `...properties`) with | ||
| // `undefined`. | ||
| ...(type === 'SuppressedError' && { | ||
| error: fp.isEmpty(primary) ? undefined : primary, | ||
| suppressed: fp.isEmpty(suppressed) ? undefined : suppressed, | ||
| }), | ||
| }, | ||
| (k, v) => (typeof v === 'bigint' ? v.toString() : v), | ||
| ), | ||
| ), | ||
| ] | ||
| } finally { | ||
| delete error[kSeen] | ||
| } | ||
| try { | ||
| const ctorName = Object.prototype.toString.call(err.constructor) === '[object Function]' | ||
| ? err.constructor.name | ||
| : err.name; | ||
| // A live error's `type` field is not trusted as its class (2cc5ebdc) — but | ||
| // when the constructor yields only the generic Error/AggregateError name | ||
| // (e.g. an error reconstructed by parseError), an own string `type` is the | ||
| // original class and must survive re-serialization. | ||
| const type = typeof err.type === 'string' && | ||
| (fp.isPlainObject(err) || ctorName === 'Error' || ctorName === 'AggregateError') | ||
| ? err.type | ||
| : ctorName; | ||
| // Use `??`, NOT `||`: a primitive `data` of 0/false/'' is a valid value and | ||
| // must not fall through to `error.body` (the `== null` gate below is | ||
| // otherwise never reached for it). Completes the fix in 7ce9ddbe. | ||
| let data = err.data ?? err.body; | ||
| if (typeof data === 'string') { | ||
| try { | ||
| data = JSON.parse(data); | ||
| } | ||
| catch { | ||
| // Do nothing... | ||
| } | ||
| } | ||
| let { msg, message = msg, code, | ||
| // Only coerce a code/signal that is already a *number*. A numeric-looking | ||
| // *string* code — e.g. a pg SQLSTATE `'23505'` — is not a process exit | ||
| // code, but `Number('23505')` is a valid integer that used to be emitted | ||
| // as a bogus `exitCode`. A child-process exit code arrives as a number; a | ||
| // signal is either numeric or a `SIG*` name string (the Node | ||
| // child_process convention) — both are absorbed into `signalCode`. | ||
| exitCode = typeof code === 'number' ? code : undefined, signal, signalCode = typeof signal === 'number' || isSignalName(signal) ? signal : undefined, body, status, statusCode = status, headers, errors: errorsField, aggregateErrors, | ||
| // An own enumerable `toJSON` must not reach the JSON.stringify below — it | ||
| // would replace the entire serialized node with its return value. | ||
| toJSON, ...properties } = err; | ||
| // Keep the wire form clean: an own '__proto__' key would round-trip into | ||
| // parseError input, and must never reach an Object.assign target. | ||
| delete properties['__proto__']; | ||
| if (typeof message !== 'string') { | ||
| message = undefined; | ||
| } | ||
| if (!Number.isInteger(exitCode)) { | ||
| exitCode = undefined; | ||
| } | ||
| if (!Number.isInteger(signalCode) && !isSignalName(signalCode)) { | ||
| signalCode = undefined; | ||
| } | ||
| if (!Number.isInteger(statusCode)) { | ||
| statusCode = undefined; | ||
| } | ||
| if (status != null && !Number.isInteger(status)) { | ||
| // A non-integer `status` (e.g. a monitor-style status object) is not a | ||
| // statusCode alias; keep it as a plain property instead of dropping it. | ||
| properties.status = status; | ||
| } | ||
| if (!fp.isPlainObject(headers)) { | ||
| // Header containers (fetch Headers, Map) are iterable, not plain; convert | ||
| // rather than drop. Anything else is discarded as before. | ||
| try { | ||
| headers = hasEntries(headers) ? Object.fromEntries(headers.entries()) : undefined; | ||
| } | ||
| catch { | ||
| headers = undefined; | ||
| } | ||
| } | ||
| if (typeof signalCode === 'number') { | ||
| signalCode = SIGNALS[signalCode] ?? signalCode; | ||
| } | ||
| // Route through the guarded array branch (depth-bounded, falsy-filtered) | ||
| // instead of Array.prototype.flat, which recurses through a cyclic array | ||
| // before any guard can engage. | ||
| const errors = _serializeError([errorsField, aggregateErrors].filter(Boolean), { depth }) ?? []; | ||
| const cause = err.cause ? _serializeError(err.cause, { depth: depth + 1 }) : undefined; | ||
| // SuppressedError (explicit resource management): `error` (the failure that | ||
| // superseded) and `suppressed` (the earlier, hidden failure) are | ||
| // non-enumerable own properties, so they never reach `...properties` and | ||
| // must be pulled out and serialized explicitly. Gate on the type so an | ||
| // unrelated `error`/`suppressed` field on a plain object is left untouched | ||
| // in `...properties`. | ||
| const primary = type === 'SuppressedError' && err.error | ||
| ? _serializeError(err.error, { depth: depth + 1 }) | ||
| : undefined; | ||
| const suppressed = type === 'SuppressedError' && err.suppressed | ||
| ? _serializeError(err.suppressed, { depth: depth + 1 }) | ||
| : undefined; | ||
| return [ | ||
| JSON.parse(JSON.stringify({ | ||
| ...properties, | ||
| message: message ?? 'Unknown error', | ||
| type: type !== 'Object' ? type : undefined, | ||
| // Gate on `== null`, NOT fp.isEmpty: `fp.isEmpty(<any number>)` is | ||
| // always true, so a numeric `code` (e.g. 500) was silently dropped | ||
| // here — same foot-gun documented below for exit/signal/statusCode. | ||
| // Only primitive codes are meaningful: a symbol cannot be | ||
| // template-stringified and an object would emit '[object Object]'. | ||
| code: typeof code === 'string' | ||
| ? code | ||
| : typeof code === 'number' || typeof code === 'bigint' || typeof code === 'boolean' | ||
| ? `${code}` | ||
| : undefined, | ||
| // NOTE: exitCode/signalCode/statusCode are validated integers (or, | ||
| // for signalCode, a signal-name string) above. They must be gated | ||
| // on `== null`, NOT fp.isEmpty: `fp.isEmpty(<any number>)` is | ||
| // always true, so using it here silently dropped every numeric | ||
| // status/exit/signal code from the serialized error. | ||
| exitCode: exitCode == null ? undefined : exitCode, | ||
| signalCode: signalCode == null ? undefined : signalCode, | ||
| statusCode: statusCode == null ? undefined : statusCode, | ||
| headers: fp.isEmpty(headers) ? undefined : headers, | ||
| // Gate on `== null`, NOT fp.isEmpty: `fp.isEmpty(<any number>)` is | ||
| // always true, so a primitive `data` (e.g. 0, 500, false, or a | ||
| // numeric JSON string) was silently dropped here — same foot-gun | ||
| // documented above for the code/exit/signal/status fields. | ||
| data: data == null ? undefined : data, | ||
| cause: fp.isEmpty(cause) ? undefined : cause, | ||
| errors: fp.isEmpty(errors) ? undefined : errors, | ||
| // Only emit these for a genuine SuppressedError; adding them | ||
| // unconditionally would clobber an unrelated object's own | ||
| // `error`/`suppressed` field (carried in `...properties`) with | ||
| // `undefined`. | ||
| ...(type === 'SuppressedError' && { | ||
| error: fp.isEmpty(primary) ? undefined : primary, | ||
| suppressed: fp.isEmpty(suppressed) ? undefined : suppressed, | ||
| }), | ||
| }, makeReplacer(depth))), | ||
| ]; | ||
| } | ||
| finally { | ||
| delete err[kSeen]; | ||
| } | ||
| } | ||
| export function makeMessages(error, options) { | ||
| return _makeMessages(error, options, new Set()) | ||
| // Dedupe across the whole result: the recursion only dedupes inside array | ||
| // branches, so a parent and a descendant with identical content (identical | ||
| // hash id) could otherwise both survive. | ||
| return fp.uniqBy('id', _makeMessages(error, options, new Set(), 0)); | ||
| } | ||
| function _makeMessages(error, options, seen) { | ||
| if (!error || error.length === 0) { | ||
| return [] | ||
| } | ||
| if (typeof error === 'object' && error !== null) { | ||
| if (seen.has(error)) { | ||
| return [] | ||
| function _makeMessages(error, options, seen, depth) { | ||
| // Scope the emptiness check to strings and arrays: an error *object* that | ||
| // happens to carry a `length: 0` property (e.g. a stream error with a | ||
| // content length) must not be swallowed. | ||
| if (!error || ((typeof error === 'string' || Array.isArray(error)) && error.length === 0)) { | ||
| return []; | ||
| } | ||
| seen.add(error) | ||
| } | ||
| if (Array.isArray(error)) { | ||
| return fp.pipe( | ||
| fp.flattenDeep, | ||
| fp.filter(Boolean), | ||
| fp.flatMap((x) => _makeMessages(x, options, seen)), | ||
| fp.uniqBy('id'), | ||
| )(error) | ||
| } else if (Array.isArray(error.messages)) { | ||
| return _makeMessages(error.messages, options, seen) | ||
| } else if (error) { | ||
| let err | ||
| if (typeof error === 'string' && error) { | ||
| err = { msg: error, id: options?.id, level: options?.level || 50, code: options?.code } | ||
| } else if (typeof error === 'object') { | ||
| const level = parseInt(error.level) || options?.level || 50 | ||
| const code = | ||
| [error?.code, options?.codes?.[error?.code], options?.code].find( | ||
| (x) => typeof x === 'string' && x.length > 0, | ||
| ) ?? undefined | ||
| const msg = | ||
| [error.msg, error.message, code?.toLowerCase().replace(/_/g, ' ')].find( | ||
| (x) => typeof x === 'string' && x.length > 0, | ||
| ) || 'unknown error' | ||
| let data = error.data | ||
| if (typeof data === 'string') { | ||
| try { | ||
| data = JSON.parse(data) | ||
| } catch {} | ||
| } | ||
| err = { | ||
| msg, | ||
| title: error.title ?? error.name, | ||
| id: error.id ?? options?.id ?? objectHash({ msg, level, code, data }), | ||
| level, | ||
| code, | ||
| data, | ||
| expose: error.expose ?? null, | ||
| index: | ||
| error.index === null || error.index === false | ||
| ? null | ||
| : typeof error.index === 'object' | ||
| ? error.index | ||
| : error.index === undefined || error.index === true | ||
| ? options?.index === true | ||
| ? { message: msg } | ||
| : null | ||
| : null, | ||
| } | ||
| } else { | ||
| err = { | ||
| msg: 'Unknown Error', | ||
| title: 'UnknownError', | ||
| id: 'unknown_error', | ||
| level: 50, | ||
| code: 'NXT_UNKNOWN_ERROR', | ||
| data: error, | ||
| expose: null, | ||
| } | ||
| if (depth > 32) { | ||
| return []; | ||
| } | ||
| return [ | ||
| err, | ||
| ..._makeMessages( | ||
| [ | ||
| error.cause, | ||
| error.error, | ||
| error.suppressed, | ||
| error.errors, | ||
| error.messages, | ||
| error.status?.messages, | ||
| ].filter(Boolean), | ||
| options, | ||
| seen, | ||
| ), | ||
| ] | ||
| } else { | ||
| return [] | ||
| } | ||
| if (typeof error === 'string') { | ||
| // Normalize so string errors flow through the object branch and get a | ||
| // content-derived hash id: a bare options?.id — usually undefined — made | ||
| // fp.uniqBy collapse distinct strings into one message. | ||
| error = { message: error }; | ||
| } | ||
| if (typeof error === 'object' && error !== null) { | ||
| if (seen.has(error)) { | ||
| return []; | ||
| } | ||
| seen.add(error); | ||
| } | ||
| const err = error; | ||
| if (Array.isArray(error)) { | ||
| // No fp.flattenDeep here: it recurses through cyclic arrays before the | ||
| // seen-guard can engage. The flatMap recursion below deep-flattens through | ||
| // this same (guarded) branch instead. | ||
| return fp.pipe(fp.filter(Boolean), fp.flatMap((x) => _makeMessages(x, options, seen, depth + 1)), fp.uniqBy('id'))(error); | ||
| } | ||
| else if (Array.isArray(err.messages)) { | ||
| return _makeMessages(err.messages, options, seen, depth + 1); | ||
| } | ||
| else if (typeof error === 'object') { | ||
| const level = (typeof err.level === 'number' || typeof err.level === 'string' | ||
| ? parseInt(err.level) | ||
| : NaN) || | ||
| options?.level || | ||
| 50; | ||
| const code = [err.code, options?.codes?.[err.code], options?.code].find((x) => typeof x === 'string' && x.length > 0); | ||
| const msg = [err.msg, err.message, code?.toLowerCase().replace(/_/g, ' ')].find((x) => typeof x === 'string' && x.length > 0) || 'unknown error'; | ||
| let data = err.data; | ||
| if (typeof data === 'string') { | ||
| try { | ||
| data = JSON.parse(data); | ||
| } | ||
| catch { } | ||
| } | ||
| const message = { | ||
| msg, | ||
| title: err.title ?? err.name, | ||
| // options.id names the *top-level* error only: applying it to every | ||
| // message in the recursion gave parents and descendants the same id and | ||
| // collapsed them under the uniqBy dedupe. ignoreUnknown: object-hash | ||
| // throws on types it cannot hash (WeakMap, Promise); skip those instead. | ||
| id: err.id ?? | ||
| (depth === 0 ? options?.id : undefined) ?? | ||
| objectHash({ msg, level, code, data }, { ignoreUnknown: true }), | ||
| level, | ||
| code, | ||
| data, | ||
| expose: err.expose ?? null, | ||
| index: err.index === null || err.index === false | ||
| ? null | ||
| : typeof err.index === 'object' | ||
| ? err.index | ||
| : err.index === undefined || err.index === true | ||
| ? options?.index === true | ||
| ? { message: msg } | ||
| : null | ||
| : null, | ||
| }; | ||
| // `error.error` is recursed unconditionally (long-standing behavior for | ||
| // wrapped-error shapes), but `suppressed` is only an error to surface on a | ||
| // genuine SuppressedError — an unrelated field on a plain object is data | ||
| // (mirrors the serializeError gate). | ||
| const isSuppressedError = (typeof SuppressedError !== 'undefined' && error instanceof SuppressedError) || | ||
| err.type === 'SuppressedError' || | ||
| err.name === 'SuppressedError'; | ||
| return [ | ||
| message, | ||
| ..._makeMessages([ | ||
| err.cause, | ||
| err.error, | ||
| isSuppressedError ? err.suppressed : undefined, | ||
| err.errors, | ||
| err.messages, | ||
| err.status?.messages, | ||
| ].filter(Boolean), options, seen, depth + 1), | ||
| ]; | ||
| } | ||
| else { | ||
| return [ | ||
| { | ||
| msg: 'Unknown Error', | ||
| title: 'UnknownError', | ||
| id: 'unknown_error', | ||
| level: 50, | ||
| code: 'NXT_UNKNOWN_ERROR', | ||
| data: error, | ||
| expose: null, | ||
| }, | ||
| ]; | ||
| } | ||
| } | ||
| export function makeErrorString(err) { | ||
| err = parseError(err) | ||
| let msg = err?.message || 'error' | ||
| if (err?.cause) { | ||
| msg += `, caused by: ${makeErrorString(err.cause)}` | ||
| } | ||
| if (Array.isArray(err?.errors)) { | ||
| msg += ': ' + err.errors.map((err) => makeErrorString(err)).join(', ') | ||
| } | ||
| // SuppressedError: `error` is the failure that superseded and `suppressed` is | ||
| // the earlier, hidden one. parseError above rebuilds it as a real instance. | ||
| if (typeof SuppressedError !== 'undefined' && err instanceof SuppressedError) { | ||
| if (err.error) { | ||
| msg += `, error: ${makeErrorString(err.error)}` | ||
| const parsed = parseError(err); | ||
| let msg = parsed?.message || 'error'; | ||
| if (parsed?.cause) { | ||
| msg += `, caused by: ${makeErrorString(parsed.cause)}`; | ||
| } | ||
| if (err.suppressed) { | ||
| msg += `, suppressed: ${makeErrorString(err.suppressed)}` | ||
| if (Array.isArray(parsed?.errors) && parsed.errors.length > 0) { | ||
| msg += ': ' + parsed.errors.map((err) => makeErrorString(err)).join(', '); | ||
| } | ||
| } | ||
| return msg | ||
| // SuppressedError: `error` is the failure that superseded and `suppressed` is | ||
| // the earlier, hidden one. parseError above rebuilds it as a real instance. | ||
| if (typeof SuppressedError !== 'undefined' && parsed instanceof SuppressedError) { | ||
| if (parsed.error) { | ||
| msg += `, error: ${makeErrorString(parsed.error)}`; | ||
| } | ||
| if (parsed.suppressed) { | ||
| msg += `, suppressed: ${makeErrorString(parsed.suppressed)}`; | ||
| } | ||
| } | ||
| return msg; | ||
| } | ||
| //# sourceMappingURL=index.js.map |
+9
-4
| { | ||
| "name": "@nxtedition/error", | ||
| "version": "1.1.39", | ||
| "version": "1.1.40", | ||
| "type": "module", | ||
@@ -15,6 +15,7 @@ "main": "lib/index.js", | ||
| "scripts": { | ||
| "build": "rimraf lib && mkdir -p lib && cp src/index.js lib/index.js && cp src/index.d.ts lib/index.d.ts", | ||
| "build": "rimraf lib && tsc -p tsconfig.build.json", | ||
| "typecheck": "tsc --noEmit", | ||
| "test": "node --test", | ||
| "test:ci": "node --test" | ||
| "test:ci": "node --test", | ||
| "test:types": "tsd" | ||
| }, | ||
@@ -26,6 +27,10 @@ "dependencies": { | ||
| "devDependencies": { | ||
| "@types/lodash": "^4.17.24", | ||
| "@types/node": "^25.9.4", | ||
| "@types/object-hash": "^3.0.6", | ||
| "rimraf": "^6.1.3", | ||
| "tsd": "^0.33.0", | ||
| "typescript": "^5.9.3" | ||
| }, | ||
| "gitHead": "44032308de159c06fc694c901a12c35a8bd628ea" | ||
| "gitHead": "67d19205b4876ee6dc1c6c75742dbd64361cf70d" | ||
| } |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
43206
201.34%5
66.67%541
36.27%6
200%1
Infinity%