ImportsourceController: catch the whole block

This commit is contained in:
Thomas Gelf 2020-10-09 11:55:24 +02:00
parent 1705e2e3e5
commit f2461bb7e9

View File

@ -172,13 +172,13 @@ class ImportsourceController extends ActionController
*/ */
public function fetchAction() public function fetchAction()
{ {
try {
$source = $this->getImportSource(); $source = $this->getImportSource();
$source->checkForChanges(); $source->checkForChanges();
$hook = ImportSourceHook::forImportSource($source); $hook = ImportSourceHook::forImportSource($source);
$data = $hook->fetchData(); $data = $hook->fetchData();
$source->applyModifiers($data); $source->applyModifiers($data);
$filename = sprintf( $filename = sprintf(
"director-importsource-%d_%s.json", "director-importsource-%d_%s.json",
$this->getParam('id'), $this->getParam('id'),
@ -188,7 +188,6 @@ class ImportsourceController extends ActionController
$response->setHeader('Content-Type', 'application/json', true); $response->setHeader('Content-Type', 'application/json', true);
$response->setHeader('Content-disposition', "attachment; filename=$filename", true); $response->setHeader('Content-disposition', "attachment; filename=$filename", true);
$response->sendHeaders(); $response->sendHeaders();
try {
$this->sendJson($this->getResponse(), $data); $this->sendJson($this->getResponse(), $data);
} catch (Exception $e) { } catch (Exception $e) {
$this->sendJsonError($response, $e->getMessage()); $this->sendJsonError($response, $e->getMessage());