richardgirges / express-fileupload

Simple express file upload middleware that wraps around busboy
MIT License
1.52k stars 261 forks source link

Unhandled promise rejection warning #257

Closed PawelSuwinski closed 3 years ago

PawelSuwinski commented 3 years ago

Hi, I think that catching writePromise rejection on busboy finish event seems too late, because it happens at dataHandler(data) on busboy data event and already in this point promise should have its reject callback in case of stream write errors.

The best solution on writePromise rejection would be stop fetching rest of the request to not waste the bandwidth, similar like it is done in closeConnection() and then call next(err) error handler (not next() middleware`, but for now I don't get a well-functioning solution for that just this one.

PawelSuwinski commented 3 years ago

Closes #256

richardgirges commented 3 years ago

Thank you!