From f89c093f0b879ac609374c77f24bf783aafed08c Mon Sep 17 00:00:00 2001 From: Etienne Trimaille Date: Tue, 10 Dec 2024 15:59:02 +0100 Subject: [PATCH] Display a generic error in case of action failure to the end-user --- .../modules/action/controllers/service.classic.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lizmap/modules/action/controllers/service.classic.php b/lizmap/modules/action/controllers/service.classic.php index 1518ad6e61..e163870a67 100644 --- a/lizmap/modules/action/controllers/service.classic.php +++ b/lizmap/modules/action/controllers/service.classic.php @@ -54,7 +54,7 @@ public function index() // Redirect if the user has no right to access this repository if (!$lizmapProject->checkAcl()) { $errors = array( - 'title' => 'Access forbiden', + 'title' => 'Access forbidden', 'detail' => jLocale::get('view~default.repository.access.denied'), ); @@ -201,10 +201,14 @@ public function index() $data = json_decode($r->data); } } catch (Exception $e) { - jLog::log('Error in project '.$repository.'/'.$project.', layer '.$layerId.', while running the query : '.$sql, 'lizmapadmin'); + jLog::log( + 'Error in project '.$repository.'/'.$project.', layer '.$layerId.', '. + 'while running the action with the PostgreSQL query : '.$sql.' → '.$e->getMessage(), + 'lizmapadmin' + ); $errors = array( - 'title' => 'An error occurred while running the PostgreSQL query !', - 'detail' => $e->getMessage(), + 'title' => 'An error occurred while processing the request', + 'detail' => 'Please contact the GIS administrator to look to the administrator logs.', ); return $this->error($errors);