Skip to content
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

Multer error fieldname #13407

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MegaSpaceHamlet
Copy link

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

When transforming a MulterError into a Nest error, the optional field property is dropped.

Issue Number: N/A

What is the new behavior?

The field property is included in the error message, if applicable.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

If Multer throws an error, some identifying information is hidden from the error message.

https://github.com/expressjs/multer/blob/aa42bea6ac7d0cb8fcb279b15a7278cda805dc63/lib/multer-error.js#L19. This is where Multer adds the optional field property.

Multer errors may include a 'field' property for certain errors. Pass it
along into the error message.
Add the possible `field` property to the `error` arg in
`transformExecption`.
@coveralls
Copy link

Pull Request Test Coverage Report for Build aa3c3f7d-478d-43ae-b28d-1cef4587eccd

Details

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.002%) to 92.125%

Totals Coverage Status
Change from base Build eacd3e56-4bed-4f5e-9bab-412a10335aab: 0.002%
Covered Lines: 6738
Relevant Lines: 7314

💛 - Coveralls

Copy link

@benjGam benjGam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look as a "refactor" change.

@MegaSpaceHamlet
Copy link
Author

MegaSpaceHamlet commented May 1, 2024

What would be a better way to classify it?

@benjGam
Copy link

benjGam commented May 3, 2024

What would be a better way to classify it?

I would personally classify it as a "Bugfix" or "Feature" determining it on the base of the first idea with which this system was developed But here, i'm not able to tell if you fixed a bug or implement a new feature, so i can't tell. But i have the feeling that do not match "Refactor" criteria.

@MegaSpaceHamlet
Copy link
Author

Yes, I think I would categorize it as a fix. Multer provides the fieldname of the file if an error occurs, but this package does not pass it along.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants