Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 96a93698
authored
Jul 04, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
移除接口日志,方便暴露原始异常
1 parent
f4343a55
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
24 deletions
project-order/src/main/java/com/dituhui/pea/order/controller/GlobalExceptionHandler.java
project-order/src/main/java/com/dituhui/pea/order/controller/GlobalExceptionHandler.java
deleted
100644 → 0
View file @
f4343a5
package
com
.
dituhui
.
pea
.
order
.
controller
;
import
com.dituhui.pea.common.Result
;
import
org.springframework.validation.BindException
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
@RestControllerAdvice
public
class
GlobalExceptionHandler
{
@ExceptionHandler
(
BindException
.
class
)
@ResponseBody
public
Result
<?>
handleBindException
(
BindException
e
)
{
// 处理 BindException 异常并返回自定义错误信息
return
Result
.
failed
(
"Invalid request parameters"
);
}
@ExceptionHandler
(
Exception
.
class
)
@ResponseBody
public
Result
<?>
handleException
(
Exception
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment