Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-20185

Eliminate calls to CRM_Core_Error::fatal()

    Details

    • Type: Epic
    • Status: Open
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: 4.7.16, 4.6.26
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Versioning Impact:
      Minor (add functionality in backwards-compatible manner)
    • Documentation Required?:
      Developer Doc
    • Funding Source:
      Needs Funding
    • Verified?:
      No

      Description

      CRM_Core_Error::fatal() is now deprecated (CRM-20181), let's have it throw an exception instead.

      The fatal() approach 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.

      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?

      For backwards compatibility, we may need to retain the existing method until extensions have a chance to remove it. (However, if they call CRM_Core_Error::fatal() when it's gone, they will get a fatal method not found, so the result may be no less ugly ...)

      NOTE THIS IS AN EPIC - PLEASE COMMIT AGAINST SUBTASKS

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              xurizaemon Chris Burgess
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: