Skip to content

Commit

Permalink
lib: fix unhandled Promise rejections
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax committed Mar 19, 2017
1 parent e884b2e commit f5030e0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,10 @@ function singleStringCoding(stream, string, on_finish, on_progress) {
deferred.resolve = resolve;
deferred.reject = reject;
});

// Since using the Promise API is optional, generating unhandled
// rejections is not okay.
deferred.promise.catch(noop);
}

assert.equal(typeof deferred.resolve, 'function');
Expand Down Expand Up @@ -610,4 +614,6 @@ function bufferIndexOfYZ(chunk) {
return -1;
}

function noop() {}

})();

0 comments on commit f5030e0

Please sign in to comment.