UNPKG

hardhat

Version:

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

58 lines 3.23 kB
import { type StackFrame } from "./helpers.js"; /** * Classifies the error based on a set of heuristics. * * This classification is later used to select different criteria to decide if * the error should be reported or not, and in some cases, how to display it in * the CLI. * * @param error The error to classify. * @param ignoreDevelopmentTimeFilter If true, the classifier will ignore the * development-time filter, which is used to exclude errors that happen during * development of Hardhat itself. This is only meant to be used for testing. * @returns The error category. */ export declare function classifyError(error: Error, ignoreDevelopmentTimeFilter?: boolean): ErrorCategory; export declare enum ErrorCategory { CJS_TO_ESM_MIGRATION_ERROR = "CJS_TO_ESM_MIGRATION_ERROR", HH2_TO_HH3_MIGRATION_ERROR = "HH2_TO_HH3_MIGRATION_ERROR", TYPESCRIPT_SUPPORT_ERROR = "TYPESCRIPT_SUPPORT_ERROR", DEVELOPMENT_TIME_ERROR = "DEVELOPMENT_TIME_ERROR", HARDHAT_ERROR = "HARDHAT_ERROR", CONFIG_LOADING_ERROR = "CONFIG_LOADING_ERROR", CONSOLE_EVALUATION_ERROR = "CONSOLE_EVALUATION_ERROR", SCRIPT_EXECUTION_ERROR = "SCRIPT_EXECUTION_ERROR", NODE_TEST_EXECUTION_ERROR = "NODE_TEST_EXECUTION_ERROR", MOCHA_TEST_EXECUTION_ERROR = "MOCHA_TEST_EXECUTION_ERROR", TASK_ACTION_ERROR = "TASK_ACTION_ERROR", PLUGIN_TASK_ACTION_ERROR = "PLUGIN_TASK_ACTION_ERROR", USER_TASK_ACTION_ERROR = "USER_TASK_ACTION_ERROR", PLUGIN_HOOK_HANDLER_ERROR = "PLUGIN_HOOK_HANDLER_ERROR", PROVIDER_INTERACTION_ERROR = "PROVIDER_INTERACTION_ERROR", EDR_ERROR = "EDR_ERROR", NETWORK_INTERACTION_ERROR = "NETWORK_INTERACTION_ERROR", RUNTIME_ENVIRONMENT_ERROR = "RUNTIME_ENVIRONMENT_ERROR", FILESYSTEM_INTERACTION_ERROR = "FILESYSTEM_INTERACTION_ERROR", UNEXPECTED_ERROR = "UNEXPECTED_ERROR" } export type UserCodeBoundaryCategory = ErrorCategory.CONFIG_LOADING_ERROR | ErrorCategory.CONSOLE_EVALUATION_ERROR | ErrorCategory.SCRIPT_EXECUTION_ERROR | ErrorCategory.NODE_TEST_EXECUTION_ERROR | ErrorCategory.MOCHA_TEST_EXECUTION_ERROR | ErrorCategory.PLUGIN_TASK_ACTION_ERROR | ErrorCategory.USER_TASK_ACTION_ERROR | ErrorCategory.PLUGIN_HOOK_HANDLER_ERROR; export declare const USER_CODE_BOUNDARY_FRAME_MATCHERS: Record<UserCodeBoundaryCategory, (frame: StackFrame) => boolean>; /** * Returns `true` for any of the filesystem/project-data error classes the * classifier knows about. This is the gate for the FILESYSTEM_INTERACTION_ERROR * category. */ export declare function isKnownFilesystemOrProjectDataError(error: Error): boolean; /** * Returns `true` for filesystem errors that callers commonly expect to surface * during normal operation (e.g. missing files, format errors). Used by both * the classifier (as part of the filesystem-interaction gate) and the filter * (to drop these errors from reporting). */ export declare function isHardhatUtilsFilesystemError(error: Error): boolean; /** * Returns `true` for filesystem errors raised by the subprocess-spawning * helpers. These are unexpected enough to be worth reporting on their own. */ export declare function isSubprocessFilesystemError(error: Error): boolean; //# sourceMappingURL=classifier.d.ts.map