Skip to content

Commit

Permalink
console: fixup error message
Browse files Browse the repository at this point in the history
Use "options.inspectOptions" instead of just "inspectOptions"

Signed-off-by: James M Snell <[email protected]>

PR-URL: #32475
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
jasnell authored and addaleax committed Mar 30, 2020
1 parent 8770fd9 commit 814d88a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/internal/console/constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,14 @@ function Console(options /* or: stdout, stderr, ignoreErrors = true */) {
if (inspectOptions.colors !== undefined &&
options.colorMode !== undefined) {
throw new ERR_INCOMPATIBLE_OPTION_PAIR(
'inspectOptions.color', 'colorMode');
'options.inspectOptions.color', 'colorMode');
}
optionsMap.set(this, inspectOptions);
} else if (inspectOptions !== undefined) {
throw new ERR_INVALID_ARG_TYPE('inspectOptions', 'object', inspectOptions);
throw new ERR_INVALID_ARG_TYPE(
'options.inspectOptions',
'object',
inspectOptions);
}

// Bind the prototype functions to this Console instance
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-console-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ out.write = err.write = (d) => {};
});
},
{
message: 'The "inspectOptions" argument must be of type object.' +
message: 'The "options.inspectOptions" property must be of type object.' +
common.invalidArgTypeHelper(inspectOptions),
code: 'ERR_INVALID_ARG_TYPE'
}
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-console-tty-colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ check(false, false, false);
});
},
{
message: 'Option "inspectOptions.color" cannot be used in ' +
message: 'Option "options.inspectOptions.color" cannot be used in ' +
'combination with option "colorMode"',
code: 'ERR_INCOMPATIBLE_OPTION_PAIR'
}
Expand Down

0 comments on commit 814d88a

Please sign in to comment.