Skip to content

Commit 0a2136e

Browse files
committed
Handle more error responses
In some cases, the JSON error response is wrapped in 'web_service_result'.
1 parent 631af94 commit 0a2136e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1313
### Fixed
1414

1515
- Set MMS id on Bib object when initiated from SRU response.
16+
- Handle more error responses.
1617

1718
## [0.7.2] - 2018-11-09
1819

src/Client.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,9 @@ protected function parseClientError(HttpException $exception)
483483
switch ($contentType) {
484484
case 'application/json':
485485
$res = json_decode($responseBody, true);
486+
if (isset($res['web_service_result'])) {
487+
$res = $res['web_service_result'];
488+
}
486489
$err = $res['errorList']['error'][0];
487490
$message = $err['errorMessage'];
488491
$code = $err['errorCode'];

0 commit comments

Comments
 (0)