1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
restexception.php
См. документацию.
1
<?
2
namespace
Bitrix\Rest;
3
4
class
RestException
5
extends
\Exception
6
{
7
const
ERROR_INTERNAL_WRONG_TRANSPORT
=
'INTERNAL_WRONG_TRANSPORT'
;
8
const
ERROR_INTERNAL_WRONG_HANDLER_CLASS
=
'INTERNAL_WRONG_HANDLER_CLASS'
;
9
const
ERROR_INTERNAL_WRONG_FILE_HANDLER
=
'INTERNAL_WRONG_FILE_HANDLER'
;
10
const
ERROR_INTERNAL_PORTAL_DELETED
=
'PORTAL_DELETED'
;
11
12
const
ERROR_OAUTH
=
'ERROR_OAUTH'
;
13
const
ERROR_METHOD_NOT_FOUND
=
'ERROR_METHOD_NOT_FOUND'
;
14
const
ERROR_OPERATION_TIME_LIMIT
=
'OPERATION_TIME_LIMIT'
;
15
const
ERROR_CORE
=
'ERROR_CORE'
;
16
const
ERROR_ARGUMENT
=
'ERROR_ARGUMENT'
;
17
const
ERROR_NOT_FOUND
=
'ERROR_NOT_FOUND'
;
18
19
protected
$status
;
20
protected
$error_code
;
21
protected
$error_additional
=
array
();
22
23
public
function
__construct
(
$message
,
$code
=
""
,
$status
= 0, \
Exception
$previous =
null
)
24
{
25
$this->status =
$status
;
26
$this->error_code =
$code
;
27
$message
= strval(
$message
);
28
29
parent::__construct(
$message
, intval(
$code
), $previous);
30
}
31
32
public
function
getErrorCode
()
33
{
34
return
$this->error_code
;
35
}
36
37
public
function
setErrorCode
(
$error_code
)
38
{
39
$this->error_code =
$error_code
;
40
$this->code = intval(
$error_code
);
41
}
42
43
public
function
getStatus
()
44
{
45
return
$this->status == 0 ? \CRestServer::STATUS_WRONG_REQUEST :
$this->status
;
46
}
47
48
public
function
setStatus
(
$status
)
49
{
50
$this->status =
$status
;
51
}
52
53
public
function
setMessage
($msg)
54
{
55
$this->message = $msg;
56
}
57
58
public
function
getAdditional
()
59
{
60
return
$this->error_additional
;
61
}
62
63
public
function
setAdditional
(
$error_additional
)
64
{
65
$this->error_additional =
$error_additional
;
66
}
67
68
public
function
setApplicationException
(\CApplicationException $ex)
69
{
70
if
($ex->getId())
71
{
72
$this->
setErrorCode
($ex->getId());
73
}
74
else
75
{
76
$this->
setErrorCode
(self::ERROR_CORE);
77
}
78
79
$this->message = $ex->getString();
80
}
81
82
public
static
function
initFromException
(\
Exception
$e)
83
{
84
$ex =
null
;
85
86
if
(is_a($e,
'\Bitrix\Main\DB\SqlException'
))
87
{
88
$ex =
new
self
(
89
"SQL query error!"
,
90
self::ERROR_CORE,
91
\CRestServer::STATUS_INTERNAL,
92
$e->getPrevious()
93
);
94
}
95
elseif
(is_a($e,
'\Bitrix\Main\SystemException'
))
96
{
97
if
(is_a($e,
'\Bitrix\Main\ArgumentException'
))
98
{
99
$ex =
new
self
(
100
$e->getMessage(),
101
self::ERROR_ARGUMENT,
102
\CRestServer::STATUS_WRONG_REQUEST,
103
$e->getPrevious()
104
);
105
106
$ex->setAdditional(
array
(
107
"argument"
=> $e->getParameter(),
108
));
109
}
110
}
111
112
if
(!$ex)
113
{
114
$ex =
new
self
(
115
$e->getMessage(),
116
$e->getCode() ? $e->getCode() : self::ERROR_CORE,
117
\CRestServer::STATUS_WRONG_REQUEST,
118
$e->getPrevious()
119
);
120
}
121
122
return
$ex;
123
}
124
}
125
?>
Bitrix\Rest\RestException
Определения
restexception.php:6
Bitrix\Rest\RestException\ERROR_INTERNAL_PORTAL_DELETED
const ERROR_INTERNAL_PORTAL_DELETED
Определения
restexception.php:10
Bitrix\Rest\RestException\setErrorCode
setErrorCode($error_code)
Определения
restexception.php:37
Bitrix\Rest\RestException\ERROR_CORE
const ERROR_CORE
Определения
restexception.php:15
Bitrix\Rest\RestException\getAdditional
getAdditional()
Определения
restexception.php:58
Bitrix\Rest\RestException\ERROR_METHOD_NOT_FOUND
const ERROR_METHOD_NOT_FOUND
Определения
restexception.php:13
Bitrix\Rest\RestException\ERROR_INTERNAL_WRONG_TRANSPORT
const ERROR_INTERNAL_WRONG_TRANSPORT
Определения
restexception.php:7
Bitrix\Rest\RestException\__construct
__construct($message, $code="", $status=0, \Exception $previous=null)
Определения
restexception.php:23
Bitrix\Rest\RestException\ERROR_OAUTH
const ERROR_OAUTH
Определения
restexception.php:12
Bitrix\Rest\RestException\ERROR_INTERNAL_WRONG_FILE_HANDLER
const ERROR_INTERNAL_WRONG_FILE_HANDLER
Определения
restexception.php:9
Bitrix\Rest\RestException\setMessage
setMessage($msg)
Определения
restexception.php:53
Bitrix\Rest\RestException\$status
$status
Определения
restexception.php:19
Bitrix\Rest\RestException\ERROR_ARGUMENT
const ERROR_ARGUMENT
Определения
restexception.php:16
Bitrix\Rest\RestException\getErrorCode
getErrorCode()
Определения
restexception.php:32
Bitrix\Rest\RestException\$error_code
$error_code
Определения
restexception.php:20
Bitrix\Rest\RestException\setApplicationException
setApplicationException(\CApplicationException $ex)
Определения
restexception.php:68
Bitrix\Rest\RestException\ERROR_NOT_FOUND
const ERROR_NOT_FOUND
Определения
restexception.php:17
Bitrix\Rest\RestException\setAdditional
setAdditional($error_additional)
Определения
restexception.php:63
Bitrix\Rest\RestException\setStatus
setStatus($status)
Определения
restexception.php:48
Bitrix\Rest\RestException\ERROR_INTERNAL_WRONG_HANDLER_CLASS
const ERROR_INTERNAL_WRONG_HANDLER_CLASS
Определения
restexception.php:8
Bitrix\Rest\RestException\$error_additional
$error_additional
Определения
restexception.php:21
Bitrix\Rest\RestException\getStatus
getStatus()
Определения
restexception.php:43
Bitrix\Rest\RestException\initFromException
static initFromException(\Exception $e)
Определения
restexception.php:82
Bitrix\Rest\RestException\ERROR_OPERATION_TIME_LIMIT
const ERROR_OPERATION_TIME_LIMIT
Определения
restexception.php:14
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$code
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения
options.php:195
Bitrix\Main\DI\Exception
Определения
circulardependencyexception.php:3
$message
$message
Определения
payment.php:8
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
bitrix
modules
rest
lib
restexception.php
Создано системой
1.14.0