-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add user info and possibly error form to sentry
- Loading branch information
Showing
6 changed files
with
66 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace App\Http\Middleware; | ||
|
||
use Closure; | ||
use Sentry\State\Scope; | ||
|
||
class SentryContext | ||
{ | ||
/** | ||
* Handle an incoming request. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Closure $next | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle($request, Closure $next) | ||
{ | ||
if (auth()->check() && app()->bound('sentry')) { | ||
\Sentry\configureScope(function (Scope $scope): void { | ||
$scope->setUser([ | ||
'id' => auth()->user()->id, | ||
'name' => auth()->user()->name, | ||
'email' => auth()->user()->email, | ||
]); | ||
}); | ||
} | ||
|
||
return $next($request); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
@extends('errors::minimal') | ||
@extends('errors::illustrated-layout') | ||
|
||
@section('title', __('Server Error')) | ||
@section('code', '500') | ||
@section('message') | ||
@if(Session::has('error')) | ||
{{Session::get('error') }} | ||
@else | ||
Something went wrong. | ||
@endif | ||
@endsection | ||
@section('image') | ||
<div class="content"> | ||
@if(app()->bound('sentry') && app('sentry')->getLastEventId()) | ||
<div class="subtitle">Error ID: {{ app('sentry')->getLastEventId() }}</div> | ||
<script> | ||
Sentry.init({ dsn: {{ env('SENTRY_LARAVEL_DSN') }} }); | ||
Sentry.showReportDialog({ eventId: '{{ app('sentry')->getLastEventId() }}' }); | ||
</script> | ||
@endif | ||
</div> | ||
@endsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters