From e74217a7bbd58cf76963c15c73221669e1153510 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 17 Mar 2015 07:40:13 +0100 Subject: [PATCH] show error message when oauth extension is missing --- controller/guicontroller.php | 15 +++++++++++++-- templates/error.php | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 templates/error.php diff --git a/controller/guicontroller.php b/controller/guicontroller.php index 127daaf..b09ef4a 100644 --- a/controller/guicontroller.php +++ b/controller/guicontroller.php @@ -59,7 +59,18 @@ class GuiController extends Controller */ public function index() { - $this->checkDeps(); + try { + $this->checkDeps(); + } catch (\Exception $e) { + $res = new TemplateResponse('grauphel', 'error'); + $res->setParams( + array( + 'message' => $e->getMessage(), + 'code' => $e->getCode(), + ) + ); + return $res; + } $res = new TemplateResponse('grauphel', 'index'); $res->setParams( @@ -301,7 +312,7 @@ class GuiController extends Controller protected function checkDeps() { if (!class_exists('OAuthProvider')) { - throw new \Exception('PHP extension "oauth" is required'); + throw new \Exception('PHP extension "oauth" is required', 1001); } } diff --git a/templates/error.php b/templates/error.php new file mode 100644 index 0000000..7ce4f8d --- /dev/null +++ b/templates/error.php @@ -0,0 +1,18 @@ + + +
+
+

grauphel - Tomboy notes server

+

Error

+

+ +

+ You need to install the PHP PECL OAuth extension to make grauphel work. + See the + + installation instructions + for more information. +

+ +
+
-- 2.30.2