aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-04-07 14:20:43 +0200
committerRuben Bridgewater <ruben@bridgewater.de>2018-04-10 01:09:02 +0200
commit252eb2deb239c940081ac20c38ccb9039f136bd3 (patch)
treebc227990c01741616ba4ce213ba3fb097ab0a9e9 /lib
parent362694401fc08f1eb312417487bfc2d3c9281a6e (diff)
downloadandroid-node-v8-252eb2deb239c940081ac20c38ccb9039f136bd3.tar.gz
android-node-v8-252eb2deb239c940081ac20c38ccb9039f136bd3.tar.bz2
android-node-v8-252eb2deb239c940081ac20c38ccb9039f136bd3.zip
assert: fix error message
`assert.throws` also accepts objects and errors as input. This fixes the error message accodingly. PR-URL: https://github.com/nodejs/node/pull/19865 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/assert.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/assert.js b/lib/assert.js
index 9c900fcaf3..8d22906c5f 100644
--- a/lib/assert.js
+++ b/lib/assert.js
@@ -465,7 +465,9 @@ async function waitForActual(block) {
function expectsError(stackStartFn, actual, error, message) {
if (typeof error === 'string') {
if (arguments.length === 4) {
- throw new ERR_INVALID_ARG_TYPE('error', ['Function', 'RegExp'], error);
+ throw new ERR_INVALID_ARG_TYPE('error',
+ ['Object', 'Error', 'Function', 'RegExp'],
+ error);
}
message = error;
error = null;