Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.7.16
-
Fix Version/s: 4.7.17
-
Component/s: Core CiviCRM
-
Labels:
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:Developer Doc
-
Funding Source:Contributed Code
-
Verified?:No
Description
CRM_Core_Error::fatal() is kind of crufty.
When hit in the site theme it looks ghastly, and there's no way for the calling code to handle a tool (eg Geocoder/Google.php) which calls ::fatal(). If this pattern was replaced with exceptions, calling code would be better placed to handle it.
Let's make CRM_Core_Error::fatal() deprecated, and have it throw an exception instead CRM-20185
Revisiting the list from CRM-9993, this could then have improved or equivalent behaviour depending on the context:
- ajax/rest: set HTTP code & return JSON with error
- drush, wp, cv: throw an exception, let CLI tool handle it
- in CMS: use CMS to return error
- job: throw an exception, API is calling it?