From: Christian Weiske Date: Tue, 17 Mar 2015 06:40:13 +0000 (+0100) Subject: show error message when oauth extension is missing X-Git-Tag: v0.5.0~7 X-Git-Url: https://git.cweiske.de/grauphel.git/commitdiff_plain/e74217a7bbd58cf76963c15c73221669e1153510?ds=sidebyside show error message when oauth extension is missing --- 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. +

+ +
+