@@ -5,8 +5,6 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors";
5
5
import { findUp } from "@nomicfoundation/hardhat-utils/fs" ;
6
6
import { isObject } from "@nomicfoundation/hardhat-utils/lang" ;
7
7
8
- import { ERRORS } from "../../../../hardhat-errors/src/descriptors.js" ;
9
-
10
8
async function findClosestHardhatConfig ( ) : Promise < string > {
11
9
let hardhatConfigPath = await findUp ( "hardhat.config.ts" ) ;
12
10
@@ -20,7 +18,7 @@ async function findClosestHardhatConfig(): Promise<string> {
20
18
return hardhatConfigPath ;
21
19
}
22
20
23
- throw new HardhatError ( ERRORS . GENERAL . NO_CONFIG_FILE_FOUND ) ;
21
+ throw new HardhatError ( HardhatError . ERRORS . GENERAL . NO_CONFIG_FILE_FOUND ) ;
24
22
}
25
23
26
24
export async function resolveConfigPath ( ) : Promise < string > {
@@ -41,19 +39,23 @@ export async function importUserConfig(configPath: string) {
41
39
const { exists } = await import ( "@nomicfoundation/hardhat-utils/fs" ) ;
42
40
43
41
if ( ! ( await exists ( normalizedPath ) ) ) {
44
- throw new HardhatError ( ERRORS . GENERAL . INVALID_CONFIG_PATH , { configPath } ) ;
42
+ throw new HardhatError ( HardhatError . ERRORS . GENERAL . INVALID_CONFIG_PATH , {
43
+ configPath,
44
+ } ) ;
45
45
}
46
46
47
47
const imported = await import ( pathToFileURL ( normalizedPath ) . href ) ;
48
48
49
49
if ( ! ( "default" in imported ) ) {
50
- throw new HardhatError ( ERRORS . GENERAL . NO_CONFIG_EXPORTED , { configPath } ) ;
50
+ throw new HardhatError ( HardhatError . ERRORS . GENERAL . NO_CONFIG_EXPORTED , {
51
+ configPath,
52
+ } ) ;
51
53
}
52
54
53
55
const config = imported . default ;
54
56
55
57
if ( ! isObject ( config ) || config === null ) {
56
- throw new HardhatError ( ERRORS . GENERAL . INVALID_CONFIG_OBJECT , {
58
+ throw new HardhatError ( HardhatError . ERRORS . GENERAL . INVALID_CONFIG_OBJECT , {
57
59
configPath,
58
60
} ) ;
59
61
}
0 commit comments