mirror of
https://github.com/appwrite/appwrite
synced 2026-05-22 16:38:32 +00:00
PR review changes for exception publishing
This commit is contained in:
parent
50c2ebc950
commit
c0ae2e6549
2 changed files with 4 additions and 11 deletions
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue