Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#560 Remove a couple of instances of fatal errors in favour of throwing exceptions #14143

Merged
merged 1 commit into from
Apr 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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