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'];