From 494da5f44937e55dc1e3180b62e2e6ef98eecc9f Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Tue, 5 Nov 2019 18:47:37 +0100 Subject: feat: include Sentry for error reporting --- index.php | 1 + 1 file changed, 1 insertion(+) (limited to 'index.php') diff --git a/index.php b/index.php index 615769d..061509d 100644 --- a/index.php +++ b/index.php @@ -13,6 +13,7 @@ require('./vendor/autoload.php'); $app = new Wcms\Application(); $app->wakeup(); +Sentry\init(['dsn' => Wcms\Config::sentrydsn()]); try { $matchoper = new Wcms\Routes(); -- cgit v1.2.3 From a1a97e168a5d3c802f12e7351b13dab0a4f68db2 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Thu, 7 Nov 2019 01:42:54 +0100 Subject: feat: better sentry conf + send catched errors --- index.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'index.php') diff --git a/index.php b/index.php index 061509d..20a424c 100644 --- a/index.php +++ b/index.php @@ -13,13 +13,24 @@ require('./vendor/autoload.php'); $app = new Wcms\Application(); $app->wakeup(); -Sentry\init(['dsn' => Wcms\Config::sentrydsn()]); +Sentry\init([ + 'dsn' => Wcms\Config::sentrydsn(), + 'release' => 'w_cms_v' . getversion(), + 'project_root' => 'app', +]); +Sentry\configureScope(function (Sentry\State\Scope $scope): void { + $scope->setUser([ + 'id' => Wcms\Config::url(), + 'username' => Wcms\Config::basepath(), + ]); +}); try { $matchoper = new Wcms\Routes(); $matchoper->match(); } catch (Exception $e) { + Sentry\captureException($e); echo '

⚠ Woops ! There is a little problem :

', $e->getMessage(), "\n"; } -- cgit v1.2.3 From 14ff62ace7a8fdc21a8d2f84bd0cbd32edca24af Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Thu, 7 Nov 2019 14:05:57 +0100 Subject: build: gen VERSION from make instead of release-it - remove @release-it/bumper module - gen VERSION from make - remove VERSION from git --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'index.php') diff --git a/index.php b/index.php index 20a424c..1c197f6 100644 --- a/index.php +++ b/index.php @@ -15,7 +15,7 @@ $app = new Wcms\Application(); $app->wakeup(); Sentry\init([ 'dsn' => Wcms\Config::sentrydsn(), - 'release' => 'w_cms_v' . getversion(), + 'release' => getversion(), 'project_root' => 'app', ]); Sentry\configureScope(function (Sentry\State\Scope $scope): void { -- cgit v1.2.3 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 From c1843c0a2ef49de3d2030398f5c14549cc1791ab Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Fri, 15 Nov 2019 15:57:46 +0100 Subject: feat: load Sentry browser as an external script - better way to check if we need to report errors in PHP - fix make file $(js_bundles) dependencies (add webpack conf) - update sentry-browser sdk and move it to dev requirements --- index.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 13f7bfa..fd9fdaa 100644 --- a/index.php +++ b/index.php @@ -13,7 +13,8 @@ require('./vendor/autoload.php'); $app = new Wcms\Application(); $app->wakeup(); -try { + +if (isreportingerrors()) { Sentry\init([ 'dsn' => Wcms\Config::sentrydsn(), 'release' => getversion(), @@ -25,8 +26,6 @@ try { 'username' => Wcms\Config::basepath(), ]); }); -} catch (Throwable $th) { - // No problem: Sentry is optionnal } try { @@ -34,10 +33,8 @@ try { $matchoper->match(); } catch (Exception $e) { - try { + if (isreportingerrors()) { 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