Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
O
ofd-service
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
位宇华
ofd-service
Commits
950fe313
Commit
950fe313
authored
Jul 05, 2024
by
位宇华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码提交
parent
f3ae73b0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
src/main/java/com/tianyi/controller/GlobalExceptionHandler.java
...in/java/com/tianyi/controller/GlobalExceptionHandler.java
+9
-3
No files found.
src/main/java/com/tianyi/controller/GlobalExceptionHandler.java
View file @
950fe313
...
...
@@ -15,11 +15,17 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice
(
"com.tianyi"
)
@Slf4j
public
class
GlobalExceptionHandler
{
/**
* 全局异常处理
*
* @param e
* @param <T>
* @return
*/
@ExceptionHandler
(
RuntimeException
.
class
)
public
<
T
>
BaseResponse
<
T
>
runtimeException
(
RuntimeException
e
)
{
public
<
T
>
BaseResponse
<
T
>
runtimeException
(
RuntimeException
e
)
{
log
.
error
(
"RuntimeException:{}"
,
e
.
getMessage
(),
e
);
return
new
BaseResponse
<>(
ErrorCode
.
KEY_REPEAT
.
getCode
(),
null
,
e
.
getMessage
());
return
new
BaseResponse
<>(
ErrorCode
.
KEY_REPEAT
.
getCode
(),
null
,
e
.
getMessage
());
}
}
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