mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-24 01:11:38 -05:00
previously, it was too loose - checking `"name" in str(exc)` returns false positives. By changing from three if statements to a loop we can cut down on unnecessary code (and ensure that the returned objects are consistent), and by using the full check constraint name we can be sure that we're only capturing exactly the right errors. Additionally, don't return the original data in the error message - it's obvious what the name is because it'll be populated in the form you just filled in.