Skip to content

Commit

Permalink
Improved exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Jul 9, 2017
1 parent c351e8c commit 9786fe7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/Connection/HTTPlugConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function call(string $method, array $params = array(), string $requestMet
} catch (ApiException $e) {
throw $e;
} catch (\Exception $e) {
throw new ApiException('Technical error occurred.', 500);
throw new ApiException('Technical error occurred.', 500, $e);
}
}

Expand All @@ -84,7 +84,7 @@ private function parseResponse(ResponseInterface $response): array
}

if (static::NOT_FOUND_MESSAGE === $content) {
throw new NotFoundException();
throw new NotFoundException('Server did not find any entity for the request.');
}

throw new ApiException($content, $response->getStatusCode());
Expand Down
11 changes: 0 additions & 11 deletions src/Exception/ApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,6 @@

final class ApiException extends \Exception
{
/**
* ApiException constructor.
*
* @param string $message
* @param int $code
*/
public function __construct(string $message, int $code = 0)
{
parent::__construct($message, $code);
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit 9786fe7

Please sign in to comment.