From f0b8fef4e729bfe575cf663dce0e4d48bf70e648 Mon Sep 17 00:00:00 2001 From: Dario Rekowski on RockPI Date: Fri, 6 Dec 2019 14:57:00 +0000 Subject: [PATCH] update error view --- src/Controller/TransactionCreationsController.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Controller/TransactionCreationsController.php b/src/Controller/TransactionCreationsController.php index 6ddd42419..8e3858d94 100644 --- a/src/Controller/TransactionCreationsController.php +++ b/src/Controller/TransactionCreationsController.php @@ -130,7 +130,12 @@ class TransactionCreationsController extends AppController 'transaction_base64' => base64_encode($builderResult['transactionBody']->serializeToString()), 'balance' => $user['balance'] ]); - $json = $response->getJson(); + //$json = $response->getJson(); + try { + $json = $response->getJson(); + } catch(Exception $ex) { + $this->Flash->error(__('result isn\'t json ') . $ex->getMessage()); + } if($json['state'] != 'success') { if($json['msg'] == 'session not found') { $session->destroy(); @@ -297,7 +302,11 @@ class TransactionCreationsController extends AppController //die($transactionbody); $response = $http->post($url . '/checkTransaction', $transactionbody, ['type' => 'json']); //var_dump($response->getStringBody()); - $json = $response->getJson(); + try { + $json = $response->getJson(); + } catch(Exception $ex) { + $this->Flash->error(__('result isn\'t json ') . $ex->getMessage()); + } if($json['state'] != 'success') { if($json['msg'] == 'session not found') { $session->destroy();