Skip to content

Commit d98750b

Browse files
committed
Don't overwrite $apiError
If there is a check for `$jsonResponse->message`, then `$apiError` shouldn't always be based on it.
1 parent bf4aae8 commit d98750b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Mozu/Api/MozuClient.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,12 @@ private function validateResponse(ResponseInterface $response) {
256256
}
257257
$this->logger->debug($jsonResponse->errorCode . " : " . (MozuConfig::$throwExceptionOn404 == true));
258258

259-
if (isset($jsonResponse->message))
259+
if (isset($jsonResponse->message)) {
260260
$apiError = new ApiException($jsonResponse->message, $statusCode);
261-
else
261+
}
262+
else {
262263
$apiError = new ApiException($response->getReasonPhrase().", inspect Mozu\Api\ApiException->items property for more details", $statusCode);
263-
$apiError = new ApiException($jsonResponse->message, $statusCode);
264+
}
264265
if (isset($jsonResponse->additionalErrorData)) {
265266
$apiError->setAdditionalErrorData( $jsonResponse->additionalErrorData);
266267
}
@@ -286,4 +287,4 @@ private function validateResponse(ResponseInterface $response) {
286287
throw $apiError;
287288
}
288289
}
289-
?>
290+
?>

0 commit comments

Comments
 (0)