Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
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
head_group
xyqb-user2
Commits
dc3469fc
Commit
dc3469fc
authored
Aug 01, 2023
by
唐峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自定义异常继承supper msg
parent
87428335
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
1 deletion
+5
-1
ExceptionHandlingController.java
...antgroup/xyqb/controller/ExceptionHandlingController.java
+1
-1
BizException.java
src/main/java/cn/quantgroup/xyqb/exception/BizException.java
+2
-0
SilentBizException.java
...java/cn/quantgroup/xyqb/exception/SilentBizException.java
+2
-0
No files found.
src/main/java/cn/quantgroup/xyqb/controller/ExceptionHandlingController.java
View file @
dc3469fc
...
@@ -207,7 +207,7 @@ public class ExceptionHandlingController implements IBaseController {
...
@@ -207,7 +207,7 @@ public class ExceptionHandlingController implements IBaseController {
return
JsonResult
.
buildErrorResultWhithCode
(
e
.
getMsg
(),
e
.
getBusinessCode
());
return
JsonResult
.
buildErrorResultWhithCode
(
e
.
getMsg
(),
e
.
getBusinessCode
());
}
}
@ExceptionHandler
(
SilentBizException
.
class
)
@ExceptionHandler
(
SilentBizException
.
class
)
public
JsonResult
<?>
handleSilentBizException
(
BizException
e
)
{
public
JsonResult
<?>
handleSilentBizException
(
Silent
BizException
e
)
{
return
JsonResult
.
buildErrorResultWhithCode
(
e
.
getMsg
(),
e
.
getBusinessCode
());
return
JsonResult
.
buildErrorResultWhithCode
(
e
.
getMsg
(),
e
.
getBusinessCode
());
}
}
}
}
src/main/java/cn/quantgroup/xyqb/exception/BizException.java
View file @
dc3469fc
...
@@ -13,11 +13,13 @@ public class BizException extends RuntimeException {
...
@@ -13,11 +13,13 @@ public class BizException extends RuntimeException {
public
BizException
(
BizExceptionEnum
bizExceptionEnum
)
{
public
BizException
(
BizExceptionEnum
bizExceptionEnum
)
{
super
(
bizExceptionEnum
.
getMsg
());
this
.
msg
=
bizExceptionEnum
.
getMsg
();
this
.
msg
=
bizExceptionEnum
.
getMsg
();
this
.
businessCode
=
bizExceptionEnum
.
getBusinessCode
();
this
.
businessCode
=
bizExceptionEnum
.
getBusinessCode
();
}
}
public
BizException
(
BizExceptionEnum
bizExceptionEnum
,
String
attach
)
{
public
BizException
(
BizExceptionEnum
bizExceptionEnum
,
String
attach
)
{
super
(
bizExceptionEnum
.
getMsg
()+
attach
);
this
.
msg
=
bizExceptionEnum
.
getMsg
()+
attach
;
this
.
msg
=
bizExceptionEnum
.
getMsg
()+
attach
;
this
.
businessCode
=
bizExceptionEnum
.
getBusinessCode
();
this
.
businessCode
=
bizExceptionEnum
.
getBusinessCode
();
}
}
...
...
src/main/java/cn/quantgroup/xyqb/exception/SilentBizException.java
View file @
dc3469fc
...
@@ -13,11 +13,13 @@ public class SilentBizException extends RuntimeException {
...
@@ -13,11 +13,13 @@ public class SilentBizException extends RuntimeException {
public
SilentBizException
(
BizExceptionEnum
bizExceptionEnum
)
{
public
SilentBizException
(
BizExceptionEnum
bizExceptionEnum
)
{
super
(
bizExceptionEnum
.
getMsg
());
this
.
msg
=
bizExceptionEnum
.
getMsg
();
this
.
msg
=
bizExceptionEnum
.
getMsg
();
this
.
businessCode
=
bizExceptionEnum
.
getBusinessCode
();
this
.
businessCode
=
bizExceptionEnum
.
getBusinessCode
();
}
}
public
SilentBizException
(
BizExceptionEnum
bizExceptionEnum
,
String
attach
)
{
public
SilentBizException
(
BizExceptionEnum
bizExceptionEnum
,
String
attach
)
{
super
(
bizExceptionEnum
.
getMsg
());
this
.
msg
=
bizExceptionEnum
.
getMsg
()+
attach
;
this
.
msg
=
bizExceptionEnum
.
getMsg
()+
attach
;
this
.
businessCode
=
bizExceptionEnum
.
getBusinessCode
();
this
.
businessCode
=
bizExceptionEnum
.
getBusinessCode
();
}
}
...
...
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