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

Improve: Executor error handler
This commit is contained in:
Christy Jacob authored and GitHub committed 2022-11-23 14:15:57 +05:30
commit e38b5cee8e
1 file changed
+4 -2
+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'];