From a21eb3be0f6f9cb10f7beaf866a4e6829fb00390 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 8 Jul 2021 15:33:33 +1000 Subject: [PATCH] Improve Hosted Exceptions --- app/Exceptions/Handler.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 3a3969a3c834..05614471953f 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -81,17 +81,23 @@ class Handler extends ExceptionHandler app('sentry')->configureScope(function (Scope $scope): void { - if(auth()->guard('contact') && auth()->guard('contact')->user()) + $name = 'hosted@invoiceninja.com'; + + if(auth()->guard('contact') && auth()->guard('contact')->user()){ + $name = "Contact = ".auth()->guard('contact')->user()->email; $key = auth()->guard('contact')->user()->company->account->key; - elseif (auth()->guard('user') && auth()->guard('user')->user()) + } + elseif (auth()->guard('user') && auth()->guard('user')->user()){ + $name = "Admin = ".auth()->guard('user')->user()->email; $key = auth()->user()->account->key; + } else $key = 'Anonymous'; $scope->setUser([ - 'id' => 'Hosted_User', + 'id' => $key, 'email' => 'hosted@invoiceninja.com', - 'name' => $key, + 'name' => $name, ]); });