fix: Replace not exists MethodNotFoundException with NotFoundException

pull/5006/head
Jakub Onderka 2019-08-14 21:27:05 +02:00
parent cf6bc6f204
commit 4ef9595023
5 changed files with 6 additions and 10 deletions

View File

@ -173,7 +173,7 @@ class LogsController extends AppController
)
);
if (empty($event)) {
throw new MethodNotFoundException('Invalid event.');
throw new NotFoundException('Invalid event.');
}
$event = $event[0];
$attribute_ids = array();

View File

@ -4240,10 +4240,6 @@ class Attribute extends AppModel
if ($paramsOnly) {
return $params;
}
if (!isset($this->validFormats[$returnFormat])) {
// this is where the new code path for the export modules will go
throw new MethodNotFoundException('Invalid export format.');
}
if (method_exists($exportTool, 'modify_params')) {
$params = $exportTool->modify_params($user, $params);
}

View File

@ -2897,6 +2897,9 @@ class Event extends AppModel
public function sendAlertEmail($id, $senderUser, $oldpublish = null, $processId = null)
{
$event = $this->fetchEvent($senderUser, array('eventid' => $id, 'includeAllTags' => true));
if (empty($event)) {
throw new NotFoundException('Invalid Event.');
}
$this->NotificationLog = ClassRegistry::init('NotificationLog');
if (!$this->NotificationLog->check($event[0]['Event']['orgc_id'], 'publish')) {
if ($processId) {
@ -2906,9 +2909,6 @@ class Event extends AppModel
}
return true;
}
if (empty($event)) {
throw new MethodNotFoundException('Invalid Event.');
}
$userConditions = array('autoalert' => 1);
$this->User = ClassRegistry::init('User');
$users = $this->User->getUsersWithAccess(

View File

@ -51,7 +51,7 @@ class EventDelegation extends AppModel
{
$event = $this->Event->fetchEvent($user, array('eventid' => $delegation['EventDelegation']['event_id']));
if (empty($event)) {
throw new MethodNotFoundException('Invalid event.');
throw new NotFoundException('Invalid event.');
}
$event = $event[0];
$event['Event']['user_id'] = $user['id'];

View File

@ -574,7 +574,7 @@ class Sighting extends AppModel
if (!isset($this->validFormats[$returnFormat])) {
// this is where the new code path for the export modules will go
throw new MethodNotFoundException('Invalid export format.');
throw new NotFoundException('Invalid export format.');
}
$exportToolParams = array(