diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 5c9357ca75d2..2eb06fb1e3ea 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -60,10 +60,17 @@ class Handler extends ExceptionHandler app('sentry')->configureScope(function (Scope $scope): void { - if (auth()->user() && auth()->user()->account->report_errors) { + if(auth()->guard('contact')->user() && auth()->guard('contact')->user()->account->report_errors) { + $scope->setUser([ + 'id' => auth()->guard('contact')->user()->account->key, + 'email' => "anonymous@example.com", + 'name' => "Anonymous User", + ]); + } + else if (auth()->user() && auth()->user()->account->report_errors) { $scope->setUser([ 'id' => auth()->user()->account->key, - 'email' => auth()->user()->email, + 'email' => "anonymous@example.com", 'name' => "Anonymous User", ]); }