Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ldy
/
phwoolcon
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0b7c0367
authored
Sep 15, 2022
by
yeran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
1 parent
f85b3e0c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
src/Router.php
src/Router.php
View file @
0b7c036
...
@@ -15,6 +15,8 @@ use Phwoolcon\Exception\Http\CsrfException;
...
@@ -15,6 +15,8 @@ use Phwoolcon\Exception\Http\CsrfException;
use
Phwoolcon\Exception\Http\NotFoundException
;
use
Phwoolcon\Exception\Http\NotFoundException
;
use
Phwoolcon\Exception\HttpException
;
use
Phwoolcon\Exception\HttpException
;
defined
(
'IS_DEBUG'
)
or
define
(
'IS_DEBUG'
,
false
);
/**
/**
* Class Router
* Class Router
*
*
...
@@ -249,9 +251,10 @@ class Router extends PhalconRouter implements ServiceAwareInterface
...
@@ -249,9 +251,10 @@ class Router extends PhalconRouter implements ServiceAwareInterface
//return static::$runningUnitTest ? $e : $e->toResponse();
//return static::$runningUnitTest ? $e : $e->toResponse();
}
catch
(
\Exception
$exception
)
{
}
catch
(
\Exception
$exception
)
{
$uuid
=
md5
(
uniqid
(
md5
(
microtime
(
true
)),
true
));
$uuid
=
md5
(
uniqid
(
md5
(
microtime
(
true
)),
true
));
$exceptionMessage
=
$exception
->
getMessage
()
.
'---'
.
"['ERRORID:'
{
$uuid
}
]"
;
if
(
IS_DEBUG
)
{
debug
(
'[Exception] File:['
.
$exception
->
getFile
()
.
'] '
.
'Line:['
.
$exception
->
getLine
()
.
'] '
.
'Message:['
.
$exceptionMessage
.
'] '
,
'ERROR'
);
$exceptionMessage
=
$exception
->
getMessage
()
.
'---'
.
"['ERRORID:'
{
$uuid
}
]"
;
debug
(
'[Exception] File:['
.
$exception
->
getFile
()
.
'] '
.
'Line:['
.
$exception
->
getLine
()
.
'] '
.
'Message:['
.
$exceptionMessage
.
'] '
,
'ERROR'
);
}
//捕获异常
//捕获异常
$response
=
new
Response
();
//获取响应实例
$response
=
new
Response
();
//获取响应实例
//判断是否为API异常
//判断是否为API异常
...
@@ -266,7 +269,7 @@ class Router extends PhalconRouter implements ServiceAwareInterface
...
@@ -266,7 +269,7 @@ class Router extends PhalconRouter implements ServiceAwareInterface
}
}
$response
->
setContent
(
$exception
->
getBody
());
//设置响应内容
$response
->
setContent
(
$exception
->
getBody
());
//设置响应内容
}
else
{
}
else
{
$errorMessage
=
"系统繁忙[ERRORID:
{
$uuid
}
]"
;
$errorMessage
=
IS_DEBUG
?
"系统繁忙[ERRORID:
{
$uuid
}
]"
:
$exception
->
getMessage
()
;
return
self
::
exceptionResponse
(
$response
,
$errorMessage
);
return
self
::
exceptionResponse
(
$response
,
$errorMessage
);
}
}
return
$response
;
return
$response
;
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment