UNPKG

hardhat

Version:

Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.

52 lines 1.86 kB
export declare enum FrameOrigin { FIRST_PARTY = "FIRST_PARTY", THIRD_PARTY = "THIRD_PARTY", USER_PROJECT = "USER_PROJECT", NODE_INTERNAL = "NODE_INTERNAL", OTHER = "OTHER" } export interface StackFrame { functionName?: string; location: string; origin: FrameOrigin; } /** * The error context encapsulates the shared derived data used by classification * and filtering. */ export interface ErrorContext { error: Error; errorChain: Error[]; lowercaseMessageByError: Map<Error, string>; stackFramesByError: Map<Error, StackFrame[]>; allStackFrames: StackFrame[]; } /** * Builds the shared derived data used by classification and filtering. * * This keeps stack parsing and cause-chain traversal consistent across * matchers, and avoids recomputing them for every category heuristic. */ export declare function createErrorContext(error: Error): ErrorContext; /** * This function should be used instead of instanceof because it is robust * under the presence of multiple installations of the same package (e.g. * multiple hardhat-utils versions). * * @param error The error * @param errorClass The error class * @returns true if the error has the same name as the error class */ export declare function hasErrorClassName(error: Error, errorClass: abstract new (...args: never[]) => Error): boolean; /** * Returns true when `value` contains any of the supplied substrings. */ export declare function includesAny(value: string | undefined, ...substrings: string[]): boolean; /** * Returns a Node-style `code` string from an error or any Error cause. * * Traversal stops when a cause is not an Error, a cycle is detected, or * `maxCauseDepth` is reached. */ export declare function getNodeErrorCode(error: Error, maxCauseDepth?: number): string | undefined; //# sourceMappingURL=helpers.d.ts.map