@jchip/error
Version:
utilities and polyfill for node.js errors
47 lines (46 loc) • 1.47 kB
TypeScript
/** options for cleanErrorStack */
declare type CleanErrorStackOptions = {
/** string to replace part of the stack trace paths */
replacePath?: false | string;
/** list of string or RegExp to match stack trace paths to ignore */
ignorePathFilter?: (string | RegExp)[];
};
/**
* Return the stack text of an error with internal modules removed
*
* @param error - error
* @param options - clean error stack options
* @returns cleaned up stack trace
*/
export declare function cleanErrorStack(error: Error, { replacePath, ignorePathFilter }?: CleanErrorStackOptions): string;
/**
* Build stack of aggregate errors
*
* @param stack - top error
* @param errors - aggregated errors
* @returns aggregate stack
*/
export declare function aggregateStack(stack: string, errors: any[]): string;
/**
* build the aggregate stack of an AggregateError
*
* @param error aggregate error
* @returns aggregate stack
*/
export declare function aggregateErrorStack(error: AggregateError): string;
/**
* AggregateError
* - https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-aggregate-error-objects
*/
export declare class AggregateError extends Error {
/** "AggregateError" */
readonly name: string;
/** errors collected */
errors: any[];
/** aggregate stack */
stack: string;
/** original error stack before generating an aggregate one */
__stack: string;
constructor(errors?: any[], msg?: string);
}
export {};