I am trying to find an optimal way to handle the following scenario:
I have an application where there are a lot of file uploads on a certain endpoint, but the validation is rather strict as per the format and quality of the uploaded files, so a lot of the uploads fail, but for dozens of different validation problems.
I am currently designing a solution in the following manner:
Wrap the responsible service method in a try-catch block, and if one error occurs, persist the broken file in a new db table for subsequent investigation, then rethrow the exception and do the rollback for the transaction. The db table can be purged constantly, so the files are stored only for investigation then dropped.
Do you see a better solution for investigating bad uploads?