dmitriy-nz / nestjs-form-data

NestJS middleware for handling multipart/form-data, which is primarily used for uploading files.
https://www.npmjs.com/package/nestjs-form-data
MIT License
117 stars 23 forks source link

Can we configure error handling in interceptor? #29

Closed dhananjaykumar880 closed 1 year ago

dhananjaykumar880 commented 2 years ago

Hi Guys,

Thank you for creating this wonderful library. it helps a lot to upload file with other data. but seems I can not use my error handling with this. My global filter for catch error is not getting trigger due to below code.

Screenshot 2022-07-12 at 6 20 21 PM

Kindly see comment code which is handling error. Kindly make is configurable if want error handling or not.

Thanks in advance.

dmitriy-nz commented 1 year ago

Hi, sorry for the long reply. I think we can remove that part of the code from FormData.interceptor.ts

            if (err.status && err.response) {
                res.status(err.status);
                return rxjs_1.of(err.response);
            }

Because it simply duplicates the standard error handling. So the custom error handler will not conflict with the library

dmitriy-nz commented 1 year ago

version 1.8.2 released with fix this issue please check, and reopen this issue if need