File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed
Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -73,10 +73,10 @@ function validateConfigurationEntry(
7373 args = value . args ;
7474 } else {
7575 throw new Error (
76- `Expected an array of strings (json.args), but got ${
77- util . inspect ( value )
78- } `
79- )
76+ `Expected an array of strings (json.args), but got ${ util . inspect (
77+ value
78+ ) } `
79+ ) ;
8080 }
8181 }
8282 if (
@@ -188,7 +188,19 @@ function validateEnvironmentOverrides(
188188 if ( hasOwnProperty ( environment , "jsonArgs" ) ) {
189189 let { jsonArgs } = environment ;
190190 if ( isString ( jsonArgs ) ) {
191- jsonArgs = JSON . parse ( jsonArgs ) ;
191+ try {
192+ jsonArgs = JSON . parse ( jsonArgs ) ;
193+ } catch ( err ) {
194+ let parseErrorMessage = "" ;
195+ if ( err instanceof Error ) {
196+ parseErrorMessage = `JSON.parse(jsonArgs) failed with message:\n${ err . message } ` ;
197+ }
198+ throw new Error (
199+ `Expected valid JSON (jsonArgs), but got ${ util . inspect (
200+ jsonArgs
201+ ) } \n${ parseErrorMessage } `
202+ ) ;
203+ }
192204 }
193205 if ( Array . isArray ( jsonArgs ) && jsonArgs . every ( isString ) ) {
194206 overrides . jsonArgs = jsonArgs ;
You can’t perform that action at this time.
0 commit comments