Merge pull request #4766 from appwrite/fb-pools-executor-err-handling

Improve: Executor error handler
This commit is contained in:
Christy Jacob
2022-11-23 14:15:57 +05:30
committed by GitHub
+4 -2
View File
@@ -94,7 +94,8 @@ class Executor
$status = $response['headers']['status-code'];
if ($status >= 400) {
throw new \Exception($response['body']['message'], $status);
$message = \is_string($response['body']) ? $response['body'] : $response['body']['message'];
throw new \Exception($message, $status);
}
return $response['body'];
@@ -146,7 +147,8 @@ class Executor
$status = $response['headers']['status-code'];
if ($status >= 400) {
throw new \Exception($response['body']['message'], $status);
$message = \is_string($response['body']) ? $response['body'] : $response['body']['message'];
throw new \Exception($message, $status);
}
return $response['body'];