- Модуль: rest
- Путь к файлу: ~/bitrix/modules/rest/lib/restexception.php
- Класс: BitrixRestRestException
- Вызов: RestException::initFromException
static function initFromException(Exception $e)
{
$ex = null;
if (is_a($e, 'BitrixMainDBSqlException'))
{
$ex = new self(
"SQL query error!",
self::ERROR_CORE,
CRestServer::STATUS_INTERNAL,
$e->getPrevious()
);
}
elseif(is_a($e, 'BitrixMainSystemException'))
{
if(is_a($e, 'BitrixMainArgumentException'))
{
$ex = new self(
$e->getMessage(),
self::ERROR_ARGUMENT,
CRestServer::STATUS_WRONG_REQUEST,
$e->getPrevious()
);
$ex->setAdditional(array(
"argument" => $e->getParameter(),
));
}
}
if(!$ex)
{
$ex = new self(
$e->getMessage(),
$e->getCode() ? $e->getCode() : self::ERROR_CORE,
CRestServer::STATUS_WRONG_REQUEST,
$e->getPrevious()
);
}
return $ex;
}