Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
QianQiXiang
haoban-manage3.0
Commits
8f1e3d6a
Commit
8f1e3d6a
authored
Jul 08, 2020
by
qwmqiuwenmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
c597fc86
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
+22
-22
GlobalExceptionHandler.java
...c/haoban/manage/web/exception/GlobalExceptionHandler.java
+22
-22
No files found.
haoban-manage3-operation-web/src/main/java/com/gic/haoban/manage/web/exception/GlobalExceptionHandler.java
View file @
8f1e3d6a
...
...
@@ -56,28 +56,28 @@ public class GlobalExceptionHandler extends WebBaseController {
return
res
;
}
@ResponseBody
@ExceptionHandler
(
Exception
.
class
)
public
HaobanResponse
ControllerException
(
HttpServletResponse
response
,
Exception
ex
)
{
logger
.
error
(
"err"
);
ex
.
printStackTrace
();
HaoBanErrCode
errCode
=
HaoBanErrCode
.
ERR_3
;
StringBuilder
sb
=
new
StringBuilder
();
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
try
(
PrintWriter
printWriter
=
new
PrintWriter
(
baos
))
{
ex
.
printStackTrace
(
printWriter
);
}
try
{
sb
.
append
(
baos
.
toString
());
}
catch
(
Exception
ignored
)
{
}
if
(
sb
.
length
()
==
0
)
{
sb
.
append
(
ex
.
getMessage
());
}
// 输出详细错误信息,便于调试
return
resultResponse
(
errCode
,
null
,
sb
.
toString
());
}
//
@ResponseBody
//
@ExceptionHandler(Exception.class)
//
public HaobanResponse ControllerException(HttpServletResponse response, Exception ex) {
//
logger.error("err");
//
ex.printStackTrace();
//
HaoBanErrCode errCode = HaoBanErrCode.ERR_3;
//
StringBuilder sb = new StringBuilder();
//
ByteArrayOutputStream baos = new ByteArrayOutputStream();
//
try (PrintWriter printWriter = new PrintWriter(baos)) {
//
ex.printStackTrace(printWriter);
//
}
//
try {
//
sb.append(baos.toString());
//
} catch (Exception ignored) {
//
}
//
if (sb.length() == 0) {
//
sb.append(ex.getMessage());
//
}
//
//
// 输出详细错误信息,便于调试
//
return resultResponse(errCode, null, sb.toString());
//
}
@ResponseBody
...
...
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