Skip to content

Instantly share code, notes, and snippets.

@tsh-code
Forked from szyku/exception2.php
Created June 10, 2019 09:39
Show Gist options
  • Save tsh-code/79a78684a54b5ce734f0c270aff4f503 to your computer and use it in GitHub Desktop.
Save tsh-code/79a78684a54b5ce734f0c270aff4f503 to your computer and use it in GitHub Desktop.
Better exception names
<?php
//....
$action = DocumentSigningAction::create($doc);
/** @var \Psr\Http\Message\ResponseInterface $response */
$response = $action->execute();
if ($response->getStatusCode() >= 500) {
throw new SigningServiceUnavailable();
}
if ($response->getStatusCode() >= 400) {
throw new BadSigningRequest();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment