Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Services/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use BoldApps\ShopifyToolkit\Exceptions\BadRequestException;
use BoldApps\ShopifyToolkit\Exceptions\NotAcceptableException;
use BoldApps\ShopifyToolkit\Exceptions\NotFoundException;
use BoldApps\ShopifyToolkit\Exceptions\ShopifyException;
use BoldApps\ShopifyToolkit\Exceptions\TooManyRequestsException;
use BoldApps\ShopifyToolkit\Exceptions\UnauthorizedException;
use BoldApps\ShopifyToolkit\Exceptions\UnprocessableEntityException;
Expand Down Expand Up @@ -182,6 +183,7 @@ public function delete($path, $params = [])
* @throws UnprocessableEntityException
* @throws TooManyRequestsException
* @throws BadRequestException
* @throws ShopifyException
*/
private function sendRequestToShopify(Request $request, array $cookies = [], $password = null)
{
Expand Down Expand Up @@ -245,7 +247,7 @@ private function sendRequestToShopify(Request $request, array $cookies = [], $pa
case 429:
throw (new TooManyRequestsException($e->getMessage()))->setResponse($response);
default:
throw $e;
throw (new ShopifyException($e->getMessage()))->setResponse($response);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want a named exception for 500 errors I think you should make a new InternalException class and throw it when the status code is 500. Changing this for all other codes would potentially be a breaking change for other users.

}
} catch (\Exception $e) {
$response = null;
Expand Down