Allow capturing uniqueness error
What does this MR do and why?
Uniqueness errors during value stream update is not handled, resulting in 500 error.
This is because Rails, when persisting an array of association records, would do a mass validation first, then persist all of them without validation. Uniqueness error can only surface during the persisting phase, as a database exception. This MR rescues such error and adds it to the ActiveModel errors, for API to serialize as response properly.
Screenshots or screen recordings
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #415404 (closed)
Edited by Mark Chao