aboutsummaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2019-11-11 18:50:56 +0100
committern-peugnet <n.peugnet@free.fr>2019-11-12 00:35:29 +0100
commite4bc65433283e0725a2e7bf07ae0c84f7905af17 (patch)
treeabf9e2c4ff0c601eda5400ef6fea9639fbd3cb18 /index.php
parentc0cf03fcb5aeaa4011c9b8eef4b9bc505b24485d (diff)
downloadwcms-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.php30
1 files changed, 19 insertions, 11 deletions
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 '<h1>⚠ Woops ! There is a little problem : </h1>', $e->getMessage(), "\n";
}