Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
szpt
Project overview
Project overview
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
以墨为白
szpt
Commits
4f9f564c
Commit
4f9f564c
authored
Jan 17, 2025
by
以墨为白
🎧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文档
parent
0e76d24b
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6737 additions
and
6639 deletions
+6737
-6639
doc/API.doc
doc/API.doc
+6726
-6639
src/main/java/com/zksy/szpt/aspect/GlobalExceptionHandler.java
...ain/java/com/zksy/szpt/aspect/GlobalExceptionHandler.java
+11
-0
No files found.
doc/API.doc
View file @
4f9f564c
This diff is collapsed.
Click to expand it.
src/main/java/com/zksy/szpt/aspect/GlobalExceptionHandler.java
View file @
4f9f564c
...
@@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
...
@@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.dao.DuplicateKeyException
;
import
org.springframework.dao.DuplicateKeyException
;
import
org.springframework.http.converter.HttpMessageNotReadableException
;
import
org.springframework.http.converter.HttpMessageNotReadableException
;
import
org.springframework.web.HttpMediaTypeNotSupportedException
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.MissingServletRequestParameterException
;
import
org.springframework.web.bind.MissingServletRequestParameterException
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
...
@@ -43,6 +44,16 @@ public class GlobalExceptionHandler {
...
@@ -43,6 +44,16 @@ public class GlobalExceptionHandler {
return
new
HttpResult
<>(
state
);
return
new
HttpResult
<>(
state
);
}
}
//请求映射问题
@ExceptionHandler
(
value
=
HttpMediaTypeNotSupportedException
.
class
)
@ResponseBody
public
HttpResult
<
HttpResultState
>
handleHttpMediaTypeNotSupportedException
(
HttpServletRequest
req
,
Exception
e
)
{
logger
.
error
(
"错误信息如下:"
,
e
);
HttpResultState
state
=
HttpResultState
.
NOTIFICATION
;
state
.
setMessage
(
e
.
getMessage
());
return
new
HttpResult
<>(
state
);
}
//not found
//not found
@ResponseBody
@ResponseBody
@ExceptionHandler
(
value
=
{
NotFoundException
.
class
,
NoHandlerFoundException
.
class
})
@ExceptionHandler
(
value
=
{
NotFoundException
.
class
,
NoHandlerFoundException
.
class
})
...
...
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