From 7766ca4daa9cc8ab722eaadfd75d2d2088f39b03 Mon Sep 17 00:00:00 2001 From: Andrew Newton Date: Thu, 8 Feb 2024 16:32:19 +0000 Subject: [PATCH] fix: improve TOPS report error handling (dvsa/olcs-selfserve#54) --- .../module/Olcs/src/Controller/DashboardController.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/selfserve/module/Olcs/src/Controller/DashboardController.php b/app/selfserve/module/Olcs/src/Controller/DashboardController.php index 47aea342c1..fd09895e0e 100644 --- a/app/selfserve/module/Olcs/src/Controller/DashboardController.php +++ b/app/selfserve/module/Olcs/src/Controller/DashboardController.php @@ -76,6 +76,12 @@ public function topsreportAction() 'refreshToken' => $session['RefreshToken']] ); $response = $this->handleCommand($redirectCmd); + + if (!$response->isOk()) { + $this->flashMessenger()->addErrorMessage($response->getResult()['messages'][0]); + return $this->redirect()->toRoute('dashboard', [], [], true); + } + $messages = $response->getResult()['messages']; $view = new \Laminas\View\Model\ViewModel();