fix: [cleanup] Some cleanup and fixes to invalid exception invocations

pull/3725/head
iglocska 2018-09-28 15:48:00 +02:00
parent e034eab1bf
commit 7624149224
2 changed files with 2 additions and 6 deletions

View File

@ -2117,7 +2117,7 @@ class AttributesController extends AppController
$returnFormat = 'json';
}
if (!isset($validFormats[$returnFormat][1])) {
throw new MethodNotFoundException('Invalid output format.');
throw new NotFoundException('Invalid output format.');
}
App::uses($validFormats[$returnFormat][1], 'Export');
$exportTool = new $validFormats[$returnFormat][1]();

View File

@ -3044,12 +3044,8 @@ class EventsController extends AppController
if ($returnFormat === 'download') {
$returnFormat = 'json';
}
if (!isset($validFormats[$returnFormat])) {
// this is where the new code path for the export modules will go
throw new MethodNotFoundException('Invalid export format.');
}
if (!isset($validFormats[$returnFormat][1])) {
throw new MethodNotFoundException('Invalid output format.');
throw new NotFoundException('Invalid output format.');
}
App::uses($validFormats[$returnFormat][1], 'Export');
$exportTool = new $validFormats[$returnFormat][1]();