diff --git a/app/controllers/general.php b/app/controllers/general.php index 1bf6b7c03a..2fce04b28e 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -613,7 +613,7 @@ App::error() $publish = $error->isPublishable(); } - if ($logger && $publish) { + if ($logger && ($publish || $error->getCode() === 0)) { try { /** @var Utopia\Database\Document $user */ $user = $utopia->getResource('user'); diff --git a/src/Appwrite/Extend/Exception.php b/src/Appwrite/Extend/Exception.php index a4bb23e755..605290d50e 100644 --- a/src/Appwrite/Extend/Exception.php +++ b/src/Appwrite/Extend/Exception.php @@ -244,17 +244,10 @@ class Exception extends \Exception { $this->errors = Config::getParam('errors'); $this->type = $type; + $this->code = $this->errors[$type]['code'] ?? $code; + $this->message = $this->errors[$type]['description'] ?? $message; - $this->publish = !isset($code) ? true : $code >= 500 || $code === 0; - - if (isset($this->errors[$type])) { - $this->code = $this->errors[$type]['code']; - $this->message = $this->errors[$type]['description']; - $this->publish = $this->errors[$type]['publish'] ?? true; - } - - $this->message = $message ?? $this->message; - $this->code = $code ?? $this->code; + $this->publish = $this->errors[$type]['publish'] ?? ($this->code >= 500); parent::__construct($this->message, $this->code, $previous); }