From eea8ec44316f9645bb209a29de631c770939517d Mon Sep 17 00:00:00 2001
From: eileen <emcnaughton@wikimedia.org>
Date: Sat, 27 Apr 2019 16:28:33 +1200
Subject: [PATCH] Remove a couple of instances of fatal errors in favour of
 throwing exceptions

https://lab.civicrm.org/dev/core/issues/560
---
 CRM/Core/BAO/File.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/CRM/Core/BAO/File.php b/CRM/Core/BAO/File.php
index c9a1265d671..c2c06bd279f 100644
--- a/CRM/Core/BAO/File.php
+++ b/CRM/Core/BAO/File.php
@@ -210,7 +210,7 @@ class CRM_Core_BAO_File extends CRM_Core_DAO_File {
     $fileDAO = new CRM_Core_DAO_File();
     $fileDAO->id = $fileID;
     if (!$fileDAO->find(TRUE)) {
-      CRM_Core_Error::fatal();
+      throw new CRM_Core_Exception(ts('File not found'));
     }
 
     // lets call a pre hook before the delete, so attachments hooks can get the info before things
@@ -226,7 +226,7 @@ class CRM_Core_BAO_File extends CRM_Core_DAO_File {
     $entityFileDAO->entity_table = $tableName;
 
     if (!$entityFileDAO->find(TRUE)) {
-      CRM_Core_Error::fatal(sprintf('No record found for given file ID - %d and entity ID - %d', $fileID, $entityID));
+      throw new CRM_Core_Exception(sprintf('No record found for given file ID - %d and entity ID - %d', $fileID, $entityID));
     }
 
     $entityFileDAO->delete();
-- 
GitLab