@@ -6,6 +6,30 @@ Requires Java 21, Spring boot 3.2.0+ and Jakarta EE 10
6
6
7
7
![ Exception Handling] ( https://miro.medium.com/v2/resize:fit:1400/format:webp/1*0s2E6-iNFqr_xptwrmJTdg.jpeg )
8
8
9
+ ## Table of Contents
10
+ 1 [ Introduction] ( https://github.com/officiallysingh/spring-boot-problem-handler#introduction )
11
+ 2 [ Installation] ( https://github.com/officiallysingh/spring-boot-problem-handler#installation )
12
+ 3 [ Features] ( https://github.com/officiallysingh/spring-boot-problem-handler#features )
13
+ 4 [ Controller Advices] ( https://github.com/officiallysingh/spring-boot-problem-handler#controller-advices )
14
+ - [ General advices] ( https://github.com/officiallysingh/spring-boot-problem-handler#general-advices-recommended-for-all-spring-rest-services )
15
+ - [ DAO advices] ( https://github.com/officiallysingh/spring-boot-problem-handler#dao-advices )
16
+ - [ Security advices] ( https://github.com/officiallysingh/spring-boot-problem-handler#security-advices )
17
+ - [ OpenAPI validation advice] ( https://github.com/officiallysingh/spring-boot-problem-handler#openapi-validation-advice )
18
+ 5 [ Configurations] ( ) (https://github.com/officiallysingh/spring-boot-problem-handler#configurations )
19
+ 6 [ Problem Properties] ( https://github.com/officiallysingh/spring-boot-problem-handler#problem-properties )
20
+ 7 [ Error Key] ( https://github.com/officiallysingh/spring-boot-problem-handler#error-key )
21
+ 8 [ Error response] ( https://github.com/officiallysingh/spring-boot-problem-handler#error-response )
22
+ 9 [ Message resolvers] ( https://github.com/officiallysingh/spring-boot-problem-handler#message-resolvers )
23
+ 10 [ Creating and throwing exceptions] ( https://github.com/officiallysingh/spring-boot-problem-handler#creating-and-throwing-exceptions )
24
+ 11 [ Stack traces] ( https://github.com/officiallysingh/spring-boot-problem-handler#stack-traces )
25
+ 12 [ Cause chains] ( https://github.com/officiallysingh/spring-boot-problem-handler#cause-chains )
26
+ 13 [ Customizations] ( https://github.com/officiallysingh/spring-boot-problem-handler#customizations )
27
+ - [ Customize error response] ( https://github.com/officiallysingh/spring-boot-problem-handler#customize-error-response )
28
+ - [ Customize or Override advices] ( https://github.com/officiallysingh/spring-boot-problem-handler#customize-or-override-advices )
29
+ 14 [ Define new advices] ( https://github.com/officiallysingh/spring-boot-problem-handler#define-new-advices )
30
+ 15 [ Testing] ( https://github.com/officiallysingh/spring-boot-problem-handler#testing )
31
+ 16 [ Example error responses] ( https://github.com/officiallysingh/spring-boot-problem-handler#example-error-responses )
32
+
9
33
## Introduction
10
34
11
35
Exception handling is a cross-cutting concern, should be kept separate from business logic and applied declaratively.
@@ -124,9 +148,9 @@ or [**`ProblemHandlingWebflux`**](src/main/java/com/ksoot/problem/spring/advice/
124
148
| ` └── ` [ ` ApplicationAdviceTraits ` ] ( src/main/java/com/ksoot/problem/spring/advice/application/ApplicationAdviceTraits.java ) | ` └── ` [ ` ApplicationAdviceTraits ` ] ( src/main/java/com/ksoot/problem/spring/advice/application/ApplicationAdviceTraits.java ) |
125
149
126
150
127
- #### Dao advices
151
+ #### DAO advices
128
152
129
- | Dao Advice Traits | Produces | Error Key |
153
+ | DAO Advice Traits | Produces | Error Key |
130
154
| ------------------------------------------------------------------------------------------------------------------------------------------| -----------------------------------------------------------| --------------------------------------------------------|
131
155
| [ ** ` DaoAdviceTraits ` ** ] ( src/main/java/com/ksoot/problem/spring/advice/dao/DaoAdviceTraits.java ) | | |
132
156
| ` ├── ` [ ** ` DataIntegrityViolationAdviceTrait ` ** ] ( src/main/java/com/ksoot/problem/spring/advice/dao/DataIntegrityViolationAdviceTrait.java ) | [ ` 500 Internal Server Error ` ] ( https://httpstatus.es/500 ) | data.integrity.violation.\< Failed DB constraint name\> |
@@ -880,7 +904,7 @@ public class WebFluxTestConfiguration {
880
904
}
881
905
```
882
906
883
- ## Examples responses
907
+ ## Example error responses
884
908
** Following are example error responses in different scenarios.**
885
909
The error response attributes ` code ` , ` title ` and ` detail ` can be customized for each error by specifying
886
910
the same in ` errors.properties ` file for different error keys which you can get by setting ` problem.debug-enabled=true ` in ` application.properties ` file
0 commit comments