Explicitly raise a FK error

This commit is contained in:
Gavin M. Roy 2021-01-11 22:31:54 -05:00
parent 849cd5bb21
commit 16b12cf470
2 changed files with 6 additions and 1 deletions

View file

@ -1 +1 @@
1.6.1 1.7.0

View file

@ -760,6 +760,11 @@ class RequestHandlerMixin:
raise problemdetails.Problem( raise problemdetails.Problem(
status_code=500, title='Query Timeout') status_code=500, title='Query Timeout')
raise web.HTTPError(500, reason='Query Timeout') raise web.HTTPError(500, reason='Query Timeout')
elif isinstance(exc, errors.ForeignKeyViolation):
if problemdetails:
raise problemdetails.Problem(
status_code=409, title='Foreign Key Violation')
raise web.HTTPError(409, reason='Foreign Key Violation')
elif isinstance(exc, errors.UniqueViolation): elif isinstance(exc, errors.UniqueViolation):
if problemdetails: if problemdetails:
raise problemdetails.Problem( raise problemdetails.Problem(