Skip to content

Commit 18ef01e

Browse files
Add some debug in exception
1 parent 490a7bc commit 18ef01e

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/Service/AbstractService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected function doCall(
5454

5555
$return = $xml->xpath('//return');
5656
if (count($return) && (int) $return[0]->errorCode !== 0) {
57-
$this->parseErrorCodeAndThrow((int) $return[0]->errorCode);
57+
$this->parseErrorCodeAndThrow((int) $return[0]->errorCode, $url, $options);
5858
}
5959

6060
return $this->parseResponse($xml);

src/Service/PickupPointByIdService.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,15 @@ public function parseResponse($response): ?PickupPoint
4545
return null;
4646
}
4747

48-
public function parseErrorCodeAndThrow(int $errorCode): void
48+
public function parseErrorCodeAndThrow(int $errorCode, string $url = '', array $options = []): void
4949
{
50-
throw new PickupPointsRequestException(PickupErrorsCodes::ERRORS[$errorCode]);
50+
throw new PickupPointsRequestException(
51+
sprintf(
52+
'%s [DEBUG : url = %s, options = %s]',
53+
PickupErrorsCodes::ERRORS[$errorCode],
54+
$url,
55+
json_encode($options)
56+
)
57+
);
5158
}
5259
}

0 commit comments

Comments
 (0)