Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
traffic-signal-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
signal
traffic-signal-platform
Commits
4042afaa
Commit
4042afaa
authored
Mar 08, 2023
by
hanbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 增加全局异常类
parent
a3877f58
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
GlobalExceptionHandler.java
...on/framework/exceptionhandler/GlobalExceptionHandler.java
+9
-0
No files found.
wj-common/src/main/java/net/wanji/common/framework/exceptionhandler/GlobalExceptionHandler.java
View file @
4042afaa
...
@@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
import
net.wanji.common.framework.exception.FeignServiceException
;
import
net.wanji.common.framework.exception.FeignServiceException
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
org.springframework.dao.DuplicateKeyException
;
import
org.springframework.dao.DuplicateKeyException
;
import
org.springframework.http.converter.HttpMessageNotReadableException
;
import
org.springframework.validation.FieldError
;
import
org.springframework.validation.FieldError
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
...
@@ -121,6 +122,14 @@ public class GlobalExceptionHandler {
...
@@ -121,6 +122,14 @@ public class GlobalExceptionHandler {
return
JsonViewObject
.
newInstance
().
fail
(
"feign远程服务调用异常!位置在:"
+
errorMessage
);
return
JsonViewObject
.
newInstance
().
fail
(
"feign远程服务调用异常!位置在:"
+
errorMessage
);
}
}
/**
* 输入值与数据类型不匹配
*/
@ExceptionHandler
(
value
=
HttpMessageNotReadableException
.
class
)
public
JsonViewObject
httpMessageNotReadableExceptionHandler
()
{
return
JsonViewObject
.
newInstance
().
fail
(
"输入值与数据类型不匹配"
);
}
/**
/**
* 处理其他异常
* 处理其他异常
*/
*/
...
...
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