feat: update cursor errors
This commit is contained in:
parent
1ab27083c4
commit
cb922827a4
|
@ -376,11 +376,13 @@ App::error(function ($error, $utopia, $request, $response, $layout, $project, $l
|
|||
}
|
||||
|
||||
/** Wrap all exceptions inside Appwrite\Extend\Exception */
|
||||
if ($error instanceof Utopia\Exception && $error->getCode() === 400) {
|
||||
$error = new Exception($error->getMessage(), $error->getCode(), Exception::GENERAL_ARGUMENT_INVALID, $error);
|
||||
} else {
|
||||
if (!($error instanceof Exception)) {
|
||||
$error = new Exception($error->getMessage(), $error->getCode(), Exception::GENERAL_UNKNOWN, $error);
|
||||
}
|
||||
|
||||
if ($error instanceof Utopia\Exception && $error->getCode() === 400) {
|
||||
$error->setType(Exception::GENERAL_ARGUMENT_INVALID);
|
||||
}
|
||||
|
||||
$template = ($route) ? $route->getLabel('error', null) : null;
|
||||
|
||||
|
|
|
@ -159,10 +159,25 @@ class Exception extends \Exception
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the type of the exception.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType(): string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the type of the exception.
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setType(string $type): void
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue