From 52b61c5c7539e100e2a550143e888e26c2b85b7a Mon Sep 17 00:00:00 2001 From: Khushboo Verma <43381712+vermakhushboo@users.noreply.github.com> Date: Wed, 9 Aug 2023 18:37:22 +0530 Subject: [PATCH] Add description to exception --- src/Appwrite/Auth/OAuth2/Exception.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Auth/OAuth2/Exception.php b/src/Appwrite/Auth/OAuth2/Exception.php index af98fa5e9d..99408b8d64 100644 --- a/src/Appwrite/Auth/OAuth2/Exception.php +++ b/src/Appwrite/Auth/OAuth2/Exception.php @@ -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) {