File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ import type { HardhatPlugin } from "../types/plugins.js";
14
14
import type { TaskManager } from "../types/tasks.js" ;
15
15
import type { UserInterruptionManager } from "../types/user-interruptions.js" ;
16
16
17
+ import { HardhatError } from "@ignored/hardhat-vnext-errors" ;
18
+
17
19
import { ResolvedConfigurationVariableImplementation } from "./configuration-variables.js" ;
18
20
import {
19
21
buildGlobalOptionsMap ,
@@ -61,14 +63,14 @@ export class HardhatRuntimeEnvironmentImplementation
61
63
) ;
62
64
63
65
if ( userConfigValidationErrors . length > 0 ) {
64
- throw new Error (
65
- `Invalid config:\n \t${ userConfigValidationErrors
66
+ throw new HardhatError ( HardhatError . ERRORS . GENERAL . INVALID_CONFIG , {
67
+ errors : ` \t${ userConfigValidationErrors
66
68
. map (
67
69
( error ) =>
68
70
`* Config error in .${ error . path . join ( "." ) } : ${ error . message } ` ,
69
71
)
70
72
. join ( "\n\t" ) } `,
71
- ) ;
73
+ } ) ;
72
74
}
73
75
74
76
// Resolve config
Original file line number Diff line number Diff line change @@ -189,6 +189,13 @@ Please add the property "type" with the value "module" in your package.json to e
189
189
websiteDescription :
190
190
"The global option is already defined by another plugin. Please ensure that global options are uniquely named to avoid conflicts." ,
191
191
} ,
192
+ INVALID_CONFIG : {
193
+ number : 16 ,
194
+ messageTemplate : `Invalid config:
195
+ {errors}` ,
196
+ websiteTitle : "Invalid config" ,
197
+ websiteDescription : `The configuration you provided is invalid. Please check the documentation to learn how to configure Hardhat correctly.` ,
198
+ } ,
192
199
} ,
193
200
INTERNAL : {
194
201
ASSERTION_ERROR : {
You can’t perform that action at this time.
0 commit comments