Skip to content

Commit a71dd03

Browse files
authored
Merge pull request #57 from wpj-cz/main
handle importXmlInternalError gracefully in RO.php
2 parents e183c45 + 2c0e6ca commit a71dd03

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/AbraFlexi/RO.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,14 @@ public function parseResponse($responseDecoded, $responseCode)
12981298

12991299
// no break
13001300
case 401:
1301-
$msg = (\array_key_exists('message', $responseDecoded) ? $responseDecoded['message'] : $responseDecoded[key($responseDecoded)]['message']).' for '.$this->getApiURL();
1301+
if (\array_key_exists('message', $responseDecoded)) {
1302+
$msg = $responseDecoded['message'];
1303+
} elseif (isset($responseDecoded[key($responseDecoded)]['message'])) {
1304+
$msg = $responseDecoded[key($responseDecoded)]['message'];
1305+
} else {
1306+
$msg = sprintf("Unexpected response data [%s]: %s", $responseCode, json_encode($responseDecoded));
1307+
}
1308+
$msg .= ' for '.$this->getApiURL();
13021309
$this->addStatusMessage($msg, 'error');
13031310

13041311
if ($this->throwException) {

0 commit comments

Comments
 (0)