Skip to content

Commit

Permalink
Handle exceptions in case the request doesn't have a user (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
stancl authored May 18, 2020
1 parent 7ada5e2 commit 2bee717
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Context/LaravelRequestContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ public function __construct(Request $request)

public function getUser(): array
{
$user = $this->request->user();

if (! $user) {
try {
$user = $this->request->user();

if (! $user) {
return [];
}
} catch (\Throwable $e) {
return [];
}

Expand Down

0 comments on commit 2bee717

Please sign in to comment.