Remove unnecessary function call

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

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

Loading…
Cancel
Save