Could Busboy errors be wrapped?
- Dominant language
- JavaScript
- Stars
- 12.1k
- Forks
- 1.1k
- Avg merge
- 8d 2h
- Merged PRs (30d)
- 21
Description
In make-middleware.js, creating a new Busboy is wrapped in a try/catch. However, those errors are passed straight to `next`, which makes them hard to operate on. For example, Busboy throws an error immediately if the multipart boundary is missing. I'd like to turn this into a 4xx error, but right now it's a 5xx, since we can't do `instanceof MulterError`. It would be great if these errors were wrapped in a `MulterError`. In fact, I think that is maybe the only error that Busboy throws during init, in which case it could even get its own error code.
Contributor guide
Research direction
Start in make-middleware.js at the try/catch around new Busboy, then read the existing MulterError definition and how next receives initialization failures. Reproduce the missing multipart-boundary case and verify that the resulting error can be identified as a MulterError and handled as a 4xx without changing unrelated errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100