Remove unnecessary function call

master
Sven Slootweg 4 years ago
parent 346ee85f5d
commit 537b132ae8

@ -18,12 +18,10 @@ module.exports = function simpleSinkStream(_options) {
required,
wrapValueAsOption("onResult"), {
onResult: [ required, isFunction ],
onAbort: [ isFunction ],
onEnd: [ isFunction, defaultTo.literal(function defaultOnEnd() {
// We return whatever value we got last from the specified onResult callback.
return lastResult;
})],
onAbort: [ isFunction, defaultTo.literal(function defaultOnAbort() {
// no-op
})]
}
]);
@ -88,7 +86,9 @@ module.exports = function simpleSinkStream(_options) {
abortHandled = true;
return Promise.try(() => {
return onAbort();
if (onAbort != null) {
return onAbort();
}
}).then(() => {
if (marker.reason instanceof Error) {
// NOTE: This ensures that the original error causing the abort is thrown exactly once

Loading…
Cancel
Save