Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
ec8906db
Commit
ec8906db
authored
Jun 25, 2024
by
wujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改日志打印
parent
fbd64cc4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
GlobalExceptionHandler.java
...s/boot/module/hygf/api/config/GlobalExceptionHandler.java
+14
-11
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/config/GlobalExceptionHandler.java
View file @
ec8906db
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
config
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
config
;
import
lombok.extern.slf4j.Slf4j
;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.validation.BindException
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.FieldError
;
import
org.springframework.validation.ObjectError
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.multipart.MaxUploadSizeExceededException
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletRequest
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.List
;
import
lombok.extern.slf4j.Slf4j
;
/**
/**
* @description: 全局异常处理器
* @description: 全局异常处理器
...
@@ -46,8 +44,13 @@ public class GlobalExceptionHandler {
...
@@ -46,8 +44,13 @@ public class GlobalExceptionHandler {
response
.
setStatus
(
HttpStatus
.
INTERNAL_SERVER_ERROR
.
value
());
response
.
setStatus
(
HttpStatus
.
INTERNAL_SERVER_ERROR
.
value
());
response
.
setTraceId
(
RequestContext
.
getTraceId
());
response
.
setTraceId
(
RequestContext
.
getTraceId
());
response
.
setPath
(
request
.
getServletPath
());
response
.
setPath
(
request
.
getServletPath
());
response
.
setDevMessage
(
e
.
getMessage
());
// 获取异常的堆栈跟踪信息
response
.
setMessage
(
e
.
getMessage
());
StringWriter
sw
=
new
StringWriter
();
PrintWriter
pw
=
new
PrintWriter
(
sw
);
e
.
printStackTrace
(
pw
);
String
stackTrace
=
sw
.
toString
();
response
.
setDevMessage
(
stackTrace
);
response
.
setMessage
(
stackTrace
);
return
response
;
return
response
;
}
}
...
...
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