Skip to content

Commit

Permalink
Merge pull request #86 from kontenta/catch-exceptions
Browse files Browse the repository at this point in the history
Catch exceptions when authorizing
  • Loading branch information
erik-epineer authored Jan 30, 2019
2 parents 5633222 + b06a686 commit 7f1251b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Concerns/AuthorizesWithAbility.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ public function isAuthorized(Authorizable $user = null): bool
return false;
}

return $user->can($this->authorizesWithAbilityName, $this->authorizesWithAbilityArguments);
try {
return $user->can($this->authorizesWithAbilityName, $this->authorizesWithAbilityArguments);
} catch (\Exception $e) {
// Something is wrong when authorizing... perhaps the ability signature has changed?
return false;
}
}
}

0 comments on commit 7f1251b

Please sign in to comment.