Should `die()` be called when a DB Query fails?
Overview
As the title says, when a DB Query fails, CRM_Utils_File::runSqlQuery()
calls die()
and all script execution stop ahem dead. Is this intentional?
Reproduction steps
- Install the "Deduper" Extension (v1.7) via the API (sorry @eileen
🕊 ) - See the unrecoverable error "Cannot execute INSERT INTO civicrm_contact_name_pair_family (id, name_a, name_b, is_most_common_form, is_active) VALUES (65, 'Takahashi', '髙𣘺', 0, 1)".
Current behaviour
There's no way to trap this and continue with a script that installs Extensions via the API.
Edit: apparently there is a way but this seems a less than sensible way to go about trapping the error.
Expected behaviour
A script that installs Extensions via the API should be able to trap the error as an Exception
with try/catch
and act accordingly.