From 05aa67aa21b77933033027615eb30df70338c735 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 24 Mar 2020 15:17:02 -0700 Subject: [PATCH] console: fixup error message Use "options.inspectOptions" instead of just "inspectOptions" Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/32475 Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen --- lib/internal/console/constructor.js | 7 +++++-- test/parallel/test-console-instance.js | 2 +- test/parallel/test-console-tty-colors.js | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index f1ba8fbbd7c7e6..dc8dcaa1d054ed 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -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 diff --git a/test/parallel/test-console-instance.js b/test/parallel/test-console-instance.js index 19c4271d243ea7..bf22314e22e031 100644 --- a/test/parallel/test-console-instance.js +++ b/test/parallel/test-console-instance.js @@ -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' } diff --git a/test/parallel/test-console-tty-colors.js b/test/parallel/test-console-tty-colors.js index 41e72c3c8513bc..e906c71c186177 100644 --- a/test/parallel/test-console-tty-colors.js +++ b/test/parallel/test-console-tty-colors.js @@ -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' }