import { ChainErrorOptions, ObjectAny } from './types.js'; export declare class ChainError extends Error { readonly skipCauseMessage?: boolean; /** * Indicates that the new error was caused by `cause`. See `getCause()` below. * If unspecified, the cause will be `null`. */ cause?: Error; /** * Specifies arbitrary informational properties that * are available through the `ChainError.getInfo(err)` static class method. * See that method for details. */ readonly info: T; /** * For debugging, we keep track of the original message (attached * this Error particularly) separately from the concatenated message (which * includes the messages of our cause chain). */ readonly currentMessage: string; constructor(message?: string | null, optsOrError?: ChainErrorOptions | Error | null, skipCauseMessage?: boolean); /** * Returns the next `Error` in the cause chain for given `err`, * or `null` if there is no next `ChainError`. See the `cause` * argument to the constructor. Errors can have arbitrarily long cause chains. * You can walk the `cause` chain by invoking `ChainError.getCause(err)` * on each subsequent return value. */ static getCause(err: Error): Error | null | undefined; /** * Returns an object with all of the extra error information that's been associated * with this `Error` and all of its causes. These are the properties passed in using * the `info` option to the constructor. Properties not specified in the * constructor for this `Error` are implicitly inherited from this error's cause. * * These properties are intended to provide programmatically-accessible metadata * about the error. For an error that indicates a failure to resolve a DNS name, * informational properties might include the DNS name to be resolved, or even the * list of resolvers used to resolve it. The values of these properties should * generally be plain objects (i.e., consisting only of `null`, `undefined`, `numbers`, * `booleans`, `strings`, `objects` and arrays containing only other plain objects). */ static getInfo(err: Error): T; /** * The `findCauseByName()` method traverses the cause chain for given `err`, looking * for an error whose `name` property matches the passed in `name` value. If no * match is found, `null` is returned. * * If all you want is to know _whether_ there's a cause (and you don't care what it is), * you can use `ChainError.hasCauseWithName(err, name)`. * * If a vanilla error or a non-ChainError error is passed in, then there is no cause * chain to traverse. In this scenario, the method will check the `name` * property of only `err`. */ static findCauseByName(err: Error, name: string): Error | null; /** * Returns `true` if and only if `ChainError.findCauseByName(err, name)` would return * a non-null value. This essentially determines whether `err` has any cause in * its cause chain that has name `name`. */ static hasCauseWithName(err: Error, name: string): boolean; /** * Returns a string containing the full stack trace, with all nested errors recursively * reported as `'caused by:' + err.stack`. */ static getFullStack(err: Error): string; /** * Returns a string containing the full stack trace, with all nested errors recursively * reported as `'caused by:' + err.stack`. */ static getFullStackArr(err: { cause?: unknown; stack?: string; }): string[]; toString(): any; } //# sourceMappingURL=chain-error.d.ts.map