summaryrefslogtreecommitdiff
path: root/test/parallel/test-event-emitter-errors.js
diff options
context:
space:
mode:
authorChris Burkhart <christide@christide.com>2016-12-21 09:32:21 -0800
committerJames M Snell <jasnell@gmail.com>2017-03-24 16:07:35 -0700
commit2141d374527337f7e1c74c9efad217b017d945cf (patch)
tree4c26cafce830334439a2dd786e3e10e45dd7bea6 /test/parallel/test-event-emitter-errors.js
parentcfc8422a68c92808a4a2aee374623bebc768522a (diff)
downloadnode-new-2141d374527337f7e1c74c9efad217b017d945cf.tar.gz
events: update and clarify error message
Update error message that's thrown when no error listeners are attached to an emitter. PR-URL: https://github.com/nodejs/node/pull/10387 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'test/parallel/test-event-emitter-errors.js')
-rw-r--r--test/parallel/test-event-emitter-errors.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/parallel/test-event-emitter-errors.js b/test/parallel/test-event-emitter-errors.js
index 2b4a93ae98..be4f4007f0 100644
--- a/test/parallel/test-event-emitter-errors.js
+++ b/test/parallel/test-event-emitter-errors.js
@@ -5,6 +5,10 @@ const assert = require('assert');
const EE = new EventEmitter();
-assert.throws(function() {
+assert.throws(() => {
EE.emit('error', 'Accepts a string');
-}, /Accepts a string/);
+}, /^Error: Unhandled "error" event\. \(Accepts a string\)$/);
+
+assert.throws(() => {
+ EE.emit('error', {message: 'Error!'});
+}, /^Error: Unhandled "error" event\. \(\[object Object\]\)$/);