diff options
author | n-peugnet <n.peugnet@free.fr> | 2019-11-11 18:50:56 +0100 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2019-11-12 00:35:29 +0100 |
commit | e4bc65433283e0725a2e7bf07ae0c84f7905af17 (patch) | |
tree | abf9e2c4ff0c601eda5400ef6fea9639fbd3cb18 /index.php | |
parent | c0cf03fcb5aeaa4011c9b8eef4b9bc505b24485d (diff) | |
download | wcms-e4bc65433283e0725a2e7bf07ae0c84f7905af17.tar.gz wcms-e4bc65433283e0725a2e7bf07ae0c84f7905af17.zip |
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.
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 30 |
1 files changed, 19 insertions, 11 deletions
@@ -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 '<h1>⚠ Woops ! There is a little problem : </h1>', $e->getMessage(), "\n"; } |