Fix misleading error message on deadlock
authoreileen <emcnaughton@wikimedia.org>
Sun, 22 Dec 2019 20:47:10 +0000 (09:47 +1300)
committereileen <emcnaughton@wikimedia.org>
Sun, 22 Dec 2019 22:11:57 +0000 (11:11 +1300)
commit7f1a780ca77dd63cd1cd9fbf535d6e14e8529689
tree624d7193a963cb657c03ce6e4d20424af9ba2b22
parent6c97b63717f3daff39f4e3d975badb929b0d6d11
Fix misleading error message on deadlock

We were seeing error messages like
API_Exception : financial_type_id is not valid : Donation
when a deadlock was hit. The error made not sense as 'Donation' DID exist and did not help us
to identify the issue as a deadlock. It's still helpful with a deadlock to know if
a real constraint violation is hit as per https://lab.civicrm.org/dev/core/issues/1481 sometimes
a disturbing amount of queries have been rolled back.

Let's fix to handle pseudoconstants here & give a useful message.
The previously converted params did not get to this point but we can re-do that work in this low
volume function rather than do a lot of re-thinking
api/v3/utils.php
tests/phpunit/api/v3/UtilsTest.php