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
Eladmin
Commits
83f5627b
"...java/me/zhengjie/git@ustchcs.com:gujinli1118/eladmin.git" did not exist on "fd9fb2a600cb8436b1f713ddd090fccaa7c031fc"
Commit
83f5627b
authored
Oct 31, 2019
by
dqjdda
Browse files
代码优化
parent
905c8c64
Changes
1
Hide whitespace changes
Inline
Side-by-side
eladmin-common/src/main/java/me/zhengjie/exception/handler/GlobalExceptionHandler.java
View file @
83f5627b
...
...
@@ -80,7 +80,10 @@ public class GlobalExceptionHandler {
// 打印堆栈信息
log
.
error
(
ThrowableUtil
.
getStackTrace
(
e
));
String
[]
str
=
Objects
.
requireNonNull
(
e
.
getBindingResult
().
getAllErrors
().
get
(
0
).
getCodes
())[
1
].
split
(
"\\."
);
String
message
=
str
[
1
]
+
":"
+
e
.
getBindingResult
().
getAllErrors
().
get
(
0
).
getDefaultMessage
();
String
message
=
e
.
getBindingResult
().
getAllErrors
().
get
(
0
).
getDefaultMessage
();
if
(
"不能为空"
.
equals
(
message
)){
message
=
str
[
1
]
+
":"
+
message
;
}
return
buildResponseEntity
(
ApiError
.
error
(
message
));
}
...
...
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