Skip to content

Commit d014ca7

Browse files
authored
Merge pull request #100 from fschmtt/add-previous-to-shopware-response-exception
Add previous to shopware response exception
2 parents 0f487b2 + 2118bf9 commit d014ca7

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Client/AdminAuthenticator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Vin\ShopwareSdk\Data\AccessToken;
1414
use Vin\ShopwareSdk\Data\EndPointTrait;
1515
use Vin\ShopwareSdk\Exception\AuthorizationFailedException;
16+
use Vin\ShopwareSdk\Exception\ShopwareResponseException;
1617
use Vin\ShopwareSdk\Exception\ShopwareUnreachableException;
1718

1819
class AdminAuthenticator
@@ -59,7 +60,7 @@ public function fetchAccessToken(): AccessToken
5960
'headers' => self::$headers,
6061
'form_params' => $formParams
6162
]);
62-
} catch (BadResponseException $exception) {
63+
} catch (ShopwareResponseException $exception) {
6364
throw new AuthorizationFailedException(
6465
$exception->getResponse()->getBody()->getContents(),
6566
$exception->getCode(),

src/Client/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ private static function handleException(\Throwable $exception): \Throwable
192192

193193
if ($exception instanceof ClientException || $exception instanceof ServerException) {
194194
$message = $exception->getResponse()->getBody()->getContents();
195-
return new ShopwareResponseException($message, $exception->getResponse()->getStatusCode());
195+
return new ShopwareResponseException($message, $exception->getResponse()->getStatusCode(), $exception);
196196
}
197197

198198
return $exception;

0 commit comments

Comments
 (0)