Skip to content

Commit

Permalink
Merge pull request #14143 from eileenmcnaughton/dedupe3
Browse files Browse the repository at this point in the history
dev/core#560 Remove a couple of instances of fatal errors in favour of throwing exceptions
  • Loading branch information
eileenmcnaughton authored Apr 27, 2019
2 parents 07664dc + eea8ec4 commit 46be876
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CRM/Core/BAO/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public static function deleteFileReferences($fileID, $entityID, $fieldID) {
$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
Expand All @@ -226,7 +226,7 @@ public static function deleteFileReferences($fileID, $entityID, $fieldID) {
$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();
Expand Down

0 comments on commit 46be876

Please sign in to comment.