Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-myth-job
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyuan
byit-myth-job
Commits
5a7126fa
Commit
5a7126fa
authored
Aug 17, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决网关异常信息冗余的BUG
parent
31443c7d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
ErrorHandlerController.java
...a/com/byit/gateway/controller/ErrorHandlerController.java
+5
-1
No files found.
byit-myth-gateway/src/main/java/com/byit/gateway/controller/ErrorHandlerController.java
View file @
5a7126fa
...
...
@@ -5,6 +5,7 @@ import com.byit.enums.TransferResultEnum;
import
com.byit.gateway.utils.GatewayLogUtil
;
import
com.netflix.zuul.context.RequestContext
;
import
com.netflix.zuul.exception.ZuulException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.autoconfigure.web.ErrorController
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -15,6 +16,7 @@ import javax.servlet.http.HttpServletResponse;
* @author huangfu
*/
@RestController
@Slf4j
public
class
ErrorHandlerController
implements
ErrorController
{
@Override
public
String
getErrorPath
()
{
...
...
@@ -30,8 +32,10 @@ public class ErrorHandlerController implements ErrorController {
if
(
exception
==
null
)
{
code
=
TransferResultEnum
.
ERROR
.
getCode
();
msg
=
"网关异常:"
+
TransferResultEnum
.
ERROR
.
getMsg
();
log
.
error
(
"网关异常:{}"
,
TransferResultEnum
.
ERROR
.
getMsg
());
}
else
{
msg
=
"网关异常:"
+
GatewayLogUtil
.
getMessage
(
exception
);
msg
=
"网关异常:请检查调度服务是否成功启动!"
;
log
.
error
(
"网关异常:{}"
,
GatewayLogUtil
.
getMessage
(
exception
));
code
=
exception
.
nStatusCode
+
""
;
}
ResponseResult
responseResult
=
new
ResponseResult
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment