-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potential UnhandledPromiseRejection? #16
Comments
@CodeMan99 What is the recommended fix? I believe I am running into this problem. It works with This works: const gulp = require('gulp');
const download = require('gulp-download2');
gulp.task('download_server', function (done) {
downloadFoo();
done();
});
async function downloadFoo() {
download("https://my.url/file.zip")
.pipe(gulp.dest('./server'));
} As soon as I add decompress: ...
const decompress = require('gulp-decompress');
...
async function downloadFoo() {
download("https://my.url/file.zip")
.pipe(decompress())
.pipe(gulp.dest('./server'));
} It fails with:
|
@guw Basically, don't call The reason why this is needed is because the I would get around this with decompress(...)
.then(files => {
// ... happy path ... an error thrown here is sent to the `.catch` handler
})
.catch(err => {
// ... error path ... an error thrown here is sent to the promise chain (unhandled)
setImmediate(() => {
// ... next tick path ... an error thrown here is dropped
// which is OK since the callback is the error handling
cb(new PluginError('gulp-decompress:', err, {fileName: file.path}));
})
}) |
In your readme example I believe there is potentially an UnhandledPromiseRejection.
The Transform stream has no error handler so I suspect the synchronous call to the flush callback will cause it to re-throw inside the promise scope.
The text was updated successfully, but these errors were encountered: