Skip to content

Commit

Permalink
Make variable names more verbose
Browse files Browse the repository at this point in the history
This offers more context to a first time reader
  • Loading branch information
phily245 committed Aug 8, 2024
1 parent 2c05c9e commit a51e097
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 18 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@ public function status()
{
try {
Redis::ping();
} catch (Exception $e) {
} catch (Exception $exception) {
return $this->problem('Failed to connect to redis', [
'exception' => $this->exceptionContext($e),
'exception' => $this->exceptionContext($exception),
]);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Checks/CacheHealthCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public function status(): Status
}

$this->workingStores[] = $store;
} catch (Exception $e) {
} catch (Exception $exception) {
$this->exceptions[] = [
'store' => $store,
'error' => $e->getMessage()
'error' => $exception->getMessage()
];
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Checks/CrossServiceHealthCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public function status(): Status
$this->http->get($service, [
'headers' => ['X-Service-Check' => true],
]);
} catch (GuzzleException $e) {
} catch (GuzzleException $exception) {
$failedServices[] = [
'service' => $service,
'exception' => $this->exceptionContext($e),
'exception' => $this->exceptionContext($exception),
];
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Checks/DatabaseHealthCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ public function status(): Status
}

$this->database->connection($connection)->getPdo();
} catch (Exception $e) {
} catch (Exception $exception) {
return $this->problem('Could not connect to db', [
'connection' => $connection,
'exception' => $this->exceptionContext($e),
'exception' => $this->exceptionContext($exception),
]);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Checks/LogHealthCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public function status(): Status
{
try {
$this->logger->info('Checking if logs are writable');
} catch (Exception $e) {
} catch (Exception $exception) {
return $this->problem('Could not write to log file', [
'exception' => $this->exceptionContext($e),
'exception' => $this->exceptionContext($exception),
]);
}

Expand Down
5 changes: 3 additions & 2 deletions src/Checks/MigrationUpToDateHealthCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace UKFast\HealthCheck\Checks;

use Exception;
use Illuminate\Database\Migrations\Migrator;
use UKFast\HealthCheck\HealthCheck;
use UKFast\HealthCheck\Status;
Expand All @@ -23,9 +24,9 @@ public function status(): Status
['pending_migrations' => $pendingMigrations]
);
}
} catch (\Exception $e) {
} catch (Exception $exception) {
return $this->problem('Exceptions during migrations check', [
'exception' => $this->exceptionContext($e),
'exception' => $this->exceptionContext($exception),
]);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Checks/PackageSecurityHealthCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public function status(): Status
);
}
}
} catch (Exception $e) {
} catch (Exception $exception) {
return $this->problem('Failed to check packages for security vulnerabilities', [
'exception' => $this->exceptionContext($e),
'exception' => $this->exceptionContext($exception),
]);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Checks/RedisHealthCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public function status(): Status
{
try {
$this->handlePing();
} catch (Exception $e) {
} catch (Exception $exception) {
return $this->problem('Failed to connect to redis', [
'exception' => $this->exceptionContext($e),
'exception' => $this->exceptionContext($exception),
]);
}
return $this->okay();
Expand Down
4 changes: 2 additions & 2 deletions src/Checks/StorageHealthCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ public function status(): Status
}

$this->workingDisks[] = $disk;
} catch (Exception $e) {
} catch (Exception $exception) {
$this->exceptions[] = [
'disk' => $disk,
'error' => $this->exceptionContext($e),
'error' => $this->exceptionContext($exception),
];
}
}
Expand Down

0 comments on commit a51e097

Please sign in to comment.