Merge pull request #4766 from appwrite/fb-pools-executor-err-handling
Improve: Executor error handler
This commit is contained in:
commit
e38b5cee8e
1 changed files with 4 additions and 2 deletions
|
@ -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'];
|
||||
|
|
Loading…
Reference in a new issue