Skip to content

Instantly share code, notes, and snippets.

@tsh-code
Forked from szyku/exception3.php
Last active June 10, 2019 09:39
Show Gist options
  • Save tsh-code/b94d9c195782c7c9e6a50315aca27cd2 to your computer and use it in GitHub Desktop.
Save tsh-code/b94d9c195782c7c9e6a50315aca27cd2 to your computer and use it in GitHub Desktop.
Better reason
<?php
if ($response->getStatusCode() >= 400) {
$code = $this->extractErrorCode($response->getBody());
switch ($code) {
case FailReasons::NO_TAGS:
$msg = 'The document has not enough signature tags';
break;
//...
default: $msg = $this->getBodyContentAsString($response->getBody());
}
throw new BadSigningRequest($msg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment