Error Handling?
See original GitHub issueThere seems to be no error handling. I ran into an error where I had set the files limit to 1 and was trying to upload multiple files and busboy wasn’t emitting an event but apollo-upload-server was create a promise that would never resolve and the request would start hanging.
- We fist need to handle the special limits events in busboy here, https://github.com/mscdex/busboy#busboy-special-events and reject the promise if any of those are raised.
- And the inner promise should reject if the mapFieldname does not match the fieldName,
if (fieldName === mapFieldname) { // }
else { reject(new Error(`Field name mismatches ${fieldName} !== ${mapFieldname}`));
- I guess we should resolve the top level promise only on the busboy finish event.
And finally maybe the request.pipe/busboy might have some error events which need to consumed and reject the promise for safety sake.
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
What is Error Handling? - Definition from Techopedia
Error handling refers to the response and recovery procedures from error conditions present in a software application. In other words, it is the...
Read more >What is Exception Handling? - SearchSoftwareQuality
Exception handling is the process of responding to unwanted or unexpected events when a computer program runs. Exception handling deals with these events...
Read more >Express error handling
Error Handling refers to how Express catches and processes errors that occur both synchronously and asynchronously. Express comes with a default error ...
Read more >Exception handling
In computing and computer programming, exception handling is the process of responding to the occurrence of exceptions – anomalous or exceptional conditions ...
Read more >Control flow and error handling - JavaScript - MDN Web Docs
Exception handling statements. You can throw exceptions using the throw statement and handle them using the try...catch statements.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have been working on error handling all day, and have made a lot of progress but it might take a bit longer to work out the kinks. It’s amazing how little info there is on handling edge cases with Node.js streams and multipart requests, such as handling users aborting the request halfway though. Even basic questions, like how to deliberately interrupt and shutdown a stream with an error are hard to Google.
In the end, File upload scalar promises will reject with meaningful errors for all the various cases, and if an error such as a file size limit or aborted request happens when a file is still being streamed the stream will receive a meaningful
error
event. If a request is aborted, cutting off a stream, the stream will have atruncated
property like what busboy does for files that are too big.Really complicated 😓
I have same problem and I created a issue: https://github.com/jaydenseric/graphql-upload/issues/274