Skip to content

Commit

Permalink
Handle errors in cache check
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli committed Nov 3, 2024
1 parent c4cbc5c commit 741074e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Checks/CacheConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Bref\LaravelHealthCheck\CheckResult;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;
use Throwable;

class CacheConnection extends Check
{
Expand All @@ -16,8 +17,12 @@ public function getName(): string

public function check(): CheckResult
{
if (! $this->canWriteValuesToCache()) {
return $this->error();
try {
if (! $this->canWriteValuesToCache()) {
return $this->error();
}
} catch (Throwable $e) {
return $this->error($e->getMessage());
}

return $this->ok();
Expand Down

0 comments on commit 741074e

Please sign in to comment.