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
566bbae1
Commit
566bbae1
authored
Feb 11, 2025
by
夏敏伟
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://192.168.168.218/wcyuee/szpt
parents
7f7fe763
8a5e1514
Changes
2
Expand all
Show 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 @
566bbae1
This diff is collapsed.
Click to expand it.
src/main/java/com/zksy/szpt/aspect/GlobalExceptionHandler.java
View file @
566bbae1
...
...
@@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.dao.DuplicateKeyException
;
import
org.springframework.http.converter.HttpMessageNotReadableException
;
import
org.springframework.web.HttpMediaTypeNotSupportedException
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.MissingServletRequestParameterException
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
...
...
@@ -43,6 +44,16 @@ public class GlobalExceptionHandler {
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
@ResponseBody
@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