Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️
PHP attendize-alternativedoor-managementevent-check-inevent-managementevent-registrationevent-ticketingeventbrite-alternativeeventslaravelopen-sourcephpreactself-hostedsell-ticketssell-tickets-onlineticket-sellingticketing-systemtickettailor-alternativetito-alternative
chore: update sentry settings (#1112)
Dave Earleyf32e2d16058d
diff --git a/backend/app/Exceptions/Handler.php b/backend/app/Exceptions/Handler.phpindex 37c7e8f4c..535a9ef47 100644--- a/backend/app/Exceptions/Handler.php+++ b/backend/app/Exceptions/Handler.php@@ -4,6 +4,7 @@ namespace HiEvents\Exceptions;use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;use Sentry\Laravel\Facade as Sentry;+use Sentry\State\Scope;use Symfony\Component\Routing\Exception\ResourceNotFoundException as SymfonyResourceNotFoundException;use Throwable;@@ -38,7 +39,30 @@ class Handler extends ExceptionHandler*/public function report(Throwable $e){- if ($this->shouldReport($e)) {+ if ($this->shouldReport($e) && app()->bound('sentry')) {+ try {+ $user = auth()->user();+ if ($user) {+ $ip = request()->ip();+ $isImpersonating = (bool) auth()->payload()->get('is_impersonating', false);+ $impersonatorId = $isImpersonating ? auth()->payload()->get('impersonator_id') : null;++ Sentry::configureScope(function (Scope $scope) use ($user, $ip, $isImpersonating, $impersonatorId): void {+ $scope->setUser([+ 'id' => $user->id,+ 'email' => $user->email,+ 'username' => trim($user->first_name . ' ' . $user->last_name),+ 'ip_address' => $ip,+ ]);++ if ($isImpersonating) {+ $scope->setTag('is_impersonating', 'true');+ $scope->setTag('impersonator_id', (string) $impersonatorId);+ }+ });+ }+ } catch (Throwable) {+ }Sentry::captureException($e);}