1
0
Fork 0
mirror of synced 2024-10-01 01:37:56 +13:00

Add description to exception

This commit is contained in:
Khushboo Verma 2023-08-09 18:37:22 +05:30
parent e267349a88
commit 52b61c5c75

View file

@ -16,8 +16,8 @@ class Exception extends AppwriteException
$this->message = $response;
$decoded = json_decode($response, true);
if (\is_array($decoded)) {
$this->error = $decoded['error'];
$this->errorDescription = $decoded['error_description'];
$this->error = $decoded['error'] ?? $decoded['message'] ?? "Unknown error";
$this->errorDescription = $decoded['error_description'] ?? "No description";
$this->message = $this->error . ': ' . $this->errorDescription;
}
$type = match ($code) {