Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
matrix
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mall
arch
matrix
Commits
eccb2f96
Commit
eccb2f96
authored
Nov 09, 2019
by
qiuweili123
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
异常策略优化
parent
a72efeb8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
ProtocolExceptionHandler.java
protocol-starter/src/main/java/com/secoo/mall/common/handler/ProtocolExceptionHandler.java
+2
-2
AbsExceptionProcessor.java
protocol-starter/src/main/java/com/secoo/mall/common/processor/AbsExceptionProcessor.java
+7
-5
No files found.
protocol-starter/src/main/java/com/secoo/mall/common/handler/ProtocolExceptionHandler.java
View file @
eccb2f96
...
...
@@ -36,10 +36,10 @@ public class ProtocolExceptionHandler {
LoggerUtil
.
info
(
msg
);
return
ResponseUtil
.
getFailResponse
(
ex
.
getCode
(),
msg
);
}
catch
(
SystemInternalException
ex
)
{
LoggerUtil
.
error
(
e
);
LoggerUtil
.
warn
(
"WarnError"
,
ex
);
return
ResponseUtil
.
getFailResponse
(
CommonErrorCode
.
SYSTEM_INTERNAL_EXCEPTION
.
getCode
(),
CommonErrorCode
.
SYSTEM_INTERNAL_EXCEPTION
.
getMsg
());
}
catch
(
BusinessException
ex
)
{
LoggerUtil
.
warn
(
"
businessException info
:"
,
ex
);
LoggerUtil
.
warn
(
"
BizError
:"
,
ex
);
return
ResponseUtil
.
getFailResponse
(
ex
.
getCode
(),
getMsg
(
ex
));
}
catch
(
Exception
ex
)
{
LoggerUtil
.
error
(
ex
);
...
...
protocol-starter/src/main/java/com/secoo/mall/common/processor/AbsExceptionProcessor.java
View file @
eccb2f96
package
com
.
secoo
.
mall
.
common
.
processor
;
import
com.secoo.mall.common.core.exception.SystemInternalException
;
import
lombok.extern.slf4j.Slf4j
;
@Slf4j
public
abstract
class
AbsExceptionProcessor
implements
ExceptionProcessor
{
public
abstract
class
AbsExceptionProcessor
implements
ExceptionProcessor
{
public
void
process
(
Exception
e
)
throws
Exception
{
log
.
warn
(
"warn:"
,
e
);
public
void
process
(
Exception
e
)
throws
Exception
{
convertException
(
e
);
throw
e
;
//如果不进行友好的异常转换,包装为统一的错误异常抛出
log
.
error
(
"error:"
,
e
);
throw
new
SystemInternalException
();
}
protected
abstract
void
convertException
(
Exception
e
);
protected
abstract
void
convertException
(
Exception
e
);
}
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