From 4f8b663b87d6f89a35ec580a9d68df25c7219d71 Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Mon, 24 Jan 2022 16:12:46 +0100 Subject: [PATCH] chg: [localtTools:connectionRequest] Provide more info on exception --- src/Controller/LocalToolsController.php | 12 +++++++++++- templates/LocalTools/connection_request.php | 1 - 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Controller/LocalToolsController.php b/src/Controller/LocalToolsController.php index 12d9d62..baf8995 100644 --- a/src/Controller/LocalToolsController.php +++ b/src/Controller/LocalToolsController.php @@ -304,7 +304,17 @@ class LocalToolsController extends AppController throw new MethodNotAllowedException(__('No local tool ID supplied.')); } $params['local_tool_id'] = $postParams['local_tool_id']; - $encodingResult = $this->LocalTools->encodeConnection($params); + try { + $encodingResult = $this->LocalTools->encodeConnection($params); + } catch (\Exception $e) { + $encodingResult = [ + 'inboxResult' => [ + 'success' => false, + 'message' => __('Error while trying to encode connection'), + 'errors' => [$e->getMessage()], + ], + ]; + } $inboxResult = $encodingResult['inboxResult']; if ($inboxResult['success']) { if ($this->ParamHandler->isRest()) { diff --git a/templates/LocalTools/connection_request.php b/templates/LocalTools/connection_request.php index 0b8a52e..035af55 100644 --- a/templates/LocalTools/connection_request.php +++ b/templates/LocalTools/connection_request.php @@ -29,4 +29,3 @@ ] ]); ?> -