diff --git a/README.md b/README.md index ef01de1..e88f57f 100644 --- a/README.md +++ b/README.md @@ -34,13 +34,15 @@ require_once('path/to/vendor/autoload.php'); ```{php} try{ // Perform something maybe throwing an exception -} catch (CommonException\ApiException\NetworkException $exception) { - // API is not reachable or curl failed -} catch (CommonException\ApiException\ApiException $exception) { +} catch (CommonException\NetworkException\ConnectionException $exception) { + // API is not reachable +} catch (CommonException\NetworkException\CurlException $exception) { + // Curl failed +} catch (CommonException\ApiException\InvalidResponseException $exception) { // API returns an unexpected result -} catch (CommonException\ApiException\ApiLimitException $exception) { +} catch (CommonException\ApiException\RequestQuotaException $exception) { // API requests over the allowed limit -} catch (CommonException\ApiException\ApiNoResultsException $exception) { +} catch (CommonException\ApiException\NoResultsException $exception) { // API request had no result } catch (CommonException\IoException\FileWriteException $exception) { // Log file was not writable @@ -53,9 +55,11 @@ try{ ```{php} try{ // Perform something maybe throwing an exception -} catch (CommonException\ApiException\Base\BaseException $exception) { +} catch (CommonException\NetworkException\Base\NetworkException $exception) { + // Any network exception was thrown +} catch (CommonException\ApiException\Base\ApiException $exception) { // Any API exception was thrown -} catch (CommonException\IoException\Base\BaseException $exception) { +} catch (CommonException\IoException\Base\IoException $exception) { // Any IO exception was thrown } diff --git a/src/ApiException/ApiNoResultsException.php b/src/ApiException/AuthenticationException.php similarity index 54% rename from src/ApiException/ApiNoResultsException.php rename to src/ApiException/AuthenticationException.php index 1db233f..ab86b2a 100644 --- a/src/ApiException/ApiNoResultsException.php +++ b/src/ApiException/AuthenticationException.php @@ -3,11 +3,11 @@ namespace CommonException\ApiException; /** - * Class ApiNoResultsException + * Class AuthenticationException * * @package CommonException\ApiException */ -class ApiNoResultsException extends Base\BaseException +class AuthenticationException extends Base\ApiException { } diff --git a/src/ApiException/ApiException.php b/src/ApiException/Base/ApiException.php similarity index 64% rename from src/ApiException/ApiException.php rename to src/ApiException/Base/ApiException.php index 9d8e827..a24f73e 100644 --- a/src/ApiException/ApiException.php +++ b/src/ApiException/Base/ApiException.php @@ -1,6 +1,8 @@