expressjs / expressjs/multer

Error code LIMIT_UNEXPECTED_FILE is not clear enough

Open
#778 2 comments 12 reactions 0 assignees View on GitHub
discuss enhancement
Dominant language
JavaScript
Stars
12.1k
Forks
1.1k
Avg merge
8d 2h
Merged PRs (30d)
21

Description

**Context:**
The same error code `LIMIT_UNEXPECTED_FILE` is used for two scenarios:
- Request exceeds the number of files for the same part name.
- Request includes a file associated to a non expected part.

**Problem:**
This collision forces developers to propagate the list of parts that may contain files or there is no way to identify the cause of the problem.

**Solution:**
There are two possible alternatives to solve this problem:
- Create a new error code for limit excesses despite it causes breaking changes (we should release it in a major version).
- Add a new property to `MulterError` to improve the error handling.

**Next steps:**
Please, think a bit about this and vote about it. Once the choice is done, I will code the improvement and open a pull request.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.