From 9bf13a24005402b7f8c3d43393a06f19c4c9f595 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 30 Apr 2024 12:28:29 +1200 Subject: [PATCH] Update src/Appwrite/Extend/Exception.php --- src/Appwrite/Extend/Exception.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Extend/Exception.php b/src/Appwrite/Extend/Exception.php index 6f89a1d65d..b5e338f1b0 100644 --- a/src/Appwrite/Extend/Exception.php +++ b/src/Appwrite/Extend/Exception.php @@ -302,8 +302,12 @@ class Exception extends \Exception $this->type = $type; $this->code = $code ?? $this->errors[$type]['code']; - if(\is_string($this->code) && !\is_numeric($this->code)) { - $this->code = 500; + if(\is_string($this->code)) { + if (\is_numeric($this->code)) { + $this->code = (int) $this->code; + } else { + $this->code = 500; + } } $this->message = $message ?? $this->errors[$type]['description'];