Skip to content

Commit

Permalink
feature #880 Make invalid request error more clear (acrobat)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.15.x-dev branch.

Discussion
----------

Closes #879 and closes #760 

Commits
-------

f84efb4 Make invalid request error more clear
  • Loading branch information
acrobat authored Jun 13, 2020
2 parents d557dc4 + f84efb4 commit 0ce1f09
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/Github/HttpClient/Plugin/GithubExceptionThrower.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function doHandleRequest(RequestInterface $request, callable $next, calla
$content = ResponseMediator::getContent($response);
if (is_array($content) && isset($content['message'])) {
if (400 === $response->getStatusCode()) {
throw new ErrorException($content['message'], 400);
throw new ErrorException(sprintf('%s (%s)', $content['message'], $response->getReasonPhrase()), 400);
}

if (422 === $response->getStatusCode() && isset($content['errors'])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ public static function responseProvider()
],
json_encode(
[
'message' => 'Bad Request',
'message' => 'Problems parsing JSON',
]
)
),
'exception' => new \Github\Exception\ErrorException('Bad Request', 400),
'exception' => new \Github\Exception\ErrorException('Problems parsing JSON (Bad Request)', 400),
],
'422 Unprocessable Entity' => [
'response' => new Response(
Expand Down

0 comments on commit 0ce1f09

Please sign in to comment.