Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
da5beedf
Commit
da5beedf
authored
Aug 09, 2018
by
Junling Bu
Browse files
chore[litemall-core]: 添加一个IllegalArgumentException的处理器
parent
13cb8179
Changes
1
Hide whitespace changes
Inline
Side-by-side
litemall-core/src/main/java/org/linlinjava/litemall/core/config/GlobalExceptionHandler.java
View file @
da5beedf
...
...
@@ -18,31 +18,37 @@ import java.util.Set;
@ControllerAdvice
public
class
GlobalExceptionHandler
{
@ExceptionHandler
(
IllegalArgumentException
.
class
)
@ResponseBody
public
Object
badArgumentHandler
(
IllegalArgumentException
e
){
e
.
printStackTrace
();
return
ResponseUtil
.
badArgumentValue
();
}
@ExceptionHandler
(
MethodArgumentTypeMismatchException
.
class
)
@ResponseBody
public
Object
a
rgumentHandler
(
MethodArgumentTypeMismatchException
e
){
public
Object
badA
rgumentHandler
(
MethodArgumentTypeMismatchException
e
){
e
.
printStackTrace
();
return
ResponseUtil
.
badArgumentValue
();
}
@ExceptionHandler
(
MissingServletRequestParameterException
.
class
)
@ResponseBody
public
Object
a
rgumentHandler
(
MissingServletRequestParameterException
e
){
public
Object
badA
rgumentHandler
(
MissingServletRequestParameterException
e
){
e
.
printStackTrace
();
return
ResponseUtil
.
badArgumentValue
();
}
@ExceptionHandler
(
HttpMessageNotReadableException
.
class
)
@ResponseBody
public
Object
httpMessageNotReadable
Handler
(
HttpMessageNotReadableException
e
){
public
Object
badArgument
Handler
(
HttpMessageNotReadableException
e
){
e
.
printStackTrace
();
return
ResponseUtil
.
badArgumentValue
();
}
@ExceptionHandler
(
ValidationException
.
class
)
@ResponseBody
public
Object
h
andle
(
ValidationException
e
)
{
public
Object
badArgumentH
andle
r
(
ValidationException
e
)
{
e
.
printStackTrace
();
if
(
e
instanceof
ConstraintViolationException
){
ConstraintViolationException
exs
=
(
ConstraintViolationException
)
e
;
...
...
@@ -57,7 +63,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler
(
Exception
.
class
)
@ResponseBody
public
Object
exception
Handler
(
Exception
e
){
public
Object
serious
Handler
(
Exception
e
){
e
.
printStackTrace
();
return
ResponseUtil
.
serious
();
}
...
...
Write
Preview
Supports
Markdown
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