Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
schbrain-parent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
panwangnan
schbrain-parent
Commits
c2463909
"...git@gitlab.schbrain.com:panwangnan/schbrain-parent.git" did not exist on "0cb9e44307fbcea8b2e9c0158224c3e0e072ca55"
Commit
c2463909
authored
Apr 27, 2023
by
liaozan
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Release 3.0.3
parent
cf4fb49e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
10 deletions
+5
-10
commons/web-common/src/main/java/com/schbrain/common/web/exception/DefaultGlobalExceptionHandler.java
...n/common/web/exception/DefaultGlobalExceptionHandler.java
+4
-9
pom.xml
pom.xml
+1
-1
No files found.
commons/web-common/src/main/java/com/schbrain/common/web/exception/DefaultGlobalExceptionHandler.java
View file @
c2463909
...
...
@@ -2,7 +2,6 @@ package com.schbrain.common.web.exception;
import
cn.hutool.core.exceptions.ExceptionUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.schbrain.common.constants.ResponseActionConstants
;
import
com.schbrain.common.exception.BaseException
;
import
com.schbrain.common.util.EnvUtils
;
import
com.schbrain.common.web.result.ResponseDTO
;
...
...
@@ -41,8 +40,8 @@ public class DefaultGlobalExceptionHandler implements GlobalExceptionHandler {
/************************************* Base Exception Handing *************************************/
@ExceptionHandler
(
BaseException
.
class
)
public
ResponseDTO
<
String
>
handleBaseException
(
BaseException
ex
)
{
log
.
error
(
ex
.
getMessage
()
);
return
buildResponse
(
ex
,
ex
.
getCode
(),
ex
.
getAction
(),
ex
.
getMessage
()
);
log
Error
(
ex
);
return
ResponseDTO
.
error
(
ex
);
}
/************************************* Common Exception Handing *************************************/
...
...
@@ -200,19 +199,15 @@ public class DefaultGlobalExceptionHandler implements GlobalExceptionHandler {
}
protected
ResponseDTO
<
String
>
buildResponse
(
Throwable
throwable
,
int
code
,
String
message
)
{
return
buildResponse
(
throwable
,
code
,
ResponseActionConstants
.
ALERT
,
message
);
}
protected
ResponseDTO
<
String
>
buildResponse
(
Throwable
throwable
,
int
code
,
int
action
,
String
message
)
{
boolean
isProduction
=
EnvUtils
.
isProduction
();
ResponseDTO
<
String
>
responseDTO
=
getExceptionResponseMapping
(
throwable
,
isProduction
);
if
(
responseDTO
!=
null
)
{
return
responseDTO
;
}
if
(
isProduction
||
StringUtils
.
isBlank
(
message
))
{
return
ResponseDTO
.
error
(
"系统错误"
,
code
,
action
);
return
ResponseDTO
.
error
(
"系统错误"
,
code
);
}
return
ResponseDTO
.
error
(
message
,
code
,
action
);
return
ResponseDTO
.
error
(
message
,
code
);
}
protected
ResponseDTO
<
String
>
getExceptionResponseMapping
(
Throwable
throwable
,
boolean
isProduction
)
{
...
...
pom.xml
View file @
c2463909
...
...
@@ -43,7 +43,7 @@
</distributionManagement>
<properties>
<revision>
3.0.
2-SNAPSHOT
</revision>
<revision>
3.0.
3
</revision>
<java.version>
11
</java.version>
<!-- 2th part versions -->
<schbrain-apollo.version>
${revision}
</schbrain-apollo.version>
...
...
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