Skip to content

Commit

Permalink
fix: Try to get context to debug an issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kumy committed Jun 19, 2024
1 parent be5590e commit dda4f9c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion website/app/GeoKrety/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ public function write($id, $data) {
$this->set('ip', $this->_ip);
$this->set('agent', $this->_agent);
$this->set('stamp', time() + $session_lifetime);
$this->save();
if ($this->dry()) {
$this->insert();
} else {
$this->update();
}

return true;
}
Expand Down
6 changes: 3 additions & 3 deletions website/init-f3.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@
$f3->reroute($f3->get('ERROR_REDIRECT') ?: '@home');
}
if ($error['code'] === 500 && !GK_DEBUG) {
\Sentry\withScope(function (Sentry\State\Scope $scope) use ($error): void {
\Sentry\withScope(function (Sentry\State\Scope $scope) use ($error, $f3): void {
$scope->setContext('error_500', $error);

\Sentry\captureMessage($error['text']);
session_status() == PHP_SESSION_ACTIVE && Flash::instance()->addMessage(_('We are sorry, something unexpected happened.'), 'danger');
$f3->reroute('@home');
});
session_status() == PHP_SESSION_ACTIVE && Flash::instance()->addMessage(_('We are sorry, something unexpected happened.'), 'danger');
$f3->reroute('@home');
}
$header = $f3->status($error['code']);
$req = $f3->get('VERB').' '.$f3->get('PATH');
Expand Down

0 comments on commit dda4f9c

Please sign in to comment.