From e4bc65433283e0725a2e7bf07ae0c84f7905af17 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Mon, 11 Nov 2019 18:50:56 +0100 Subject: feat: make Sentry optional - move sentry to PHP dev requirements. - try...catch Sentry integration in PHP. - update Makefile: - add comments as documentation. - remove recursive call from PREV_ENV_FILE target. - make dist and sentryrelease ENV variable. - add touch target for more efficient rebuilds. - add `dist` build ENV functionnality not to include dev-requirements in the zip release. --- index.php | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 1c197f6..13f7bfa 100644 --- a/index.php +++ b/index.php @@ -13,24 +13,32 @@ require('./vendor/autoload.php'); $app = new Wcms\Application(); $app->wakeup(); -Sentry\init([ - 'dsn' => Wcms\Config::sentrydsn(), - 'release' => getversion(), - 'project_root' => 'app', -]); -Sentry\configureScope(function (Sentry\State\Scope $scope): void { - $scope->setUser([ - 'id' => Wcms\Config::url(), - 'username' => Wcms\Config::basepath(), +try { + Sentry\init([ + 'dsn' => Wcms\Config::sentrydsn(), + 'release' => getversion(), + 'project_root' => 'app', ]); -}); + Sentry\configureScope(function ($scope) { + $scope->setUser([ + 'id' => Wcms\Config::url(), + 'username' => Wcms\Config::basepath(), + ]); + }); +} catch (Throwable $th) { + // No problem: Sentry is optionnal +} try { $matchoper = new Wcms\Routes(); $matchoper->match(); } catch (Exception $e) { - Sentry\captureException($e); + try { + Sentry\captureException($e); + } catch (Throwable $th) { + // No problem: Sentry is optionnal + } echo '

⚠ Woops ! There is a little problem :

', $e->getMessage(), "\n"; } -- cgit v1.2.3