Skip to content

Commit

Permalink
Details about request when there is error
Browse files Browse the repository at this point in the history
  • Loading branch information
muxx committed Aug 25, 2020
1 parent 3ef8a62 commit 3357a51
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/Redmine/Http/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,17 @@ public function makeRequest(string $path, array $options = []): ApiResponse
}

if ($statusCode >= 500) {
throw new InternalServerErrorException('Error in redmine api.', $statusCode);
throw new InternalServerErrorException(
sprintf('Error in redmine api on %s %s', $options['method'], $path),
$statusCode
);
}

if ($statusCode >= 400 && $statusCode < 500) {
throw new BadRequestException('Error in redmine api request: ' . $responseBody, $statusCode);
throw new BadRequestException(
sprintf('Error in redmine api request %s %s: %s', $options['method'], $path, $responseBody),
$statusCode
);
}

return new ApiResponse($statusCode, $responseBody);
Expand Down

0 comments on commit 3357a51

Please sign in to comment.