blob: 1df859574e156b13af02f56d72c2313116e94b5d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
## How to use library
##### 1. Set Error Catalog service type (Database or properties file service) in application.properties file
```
##### Error Managements #####
## For database service type ##
# error.catalog.type=DB
## For database service type ##
# error.catalog.type=properties
error.catalog.applicationId=cds
error.catalog.type=properties
error.catalog.errorDefinitionDir=/opt/app/onap/config
```
##### 2. Generate exception
- HTTP Error Exception
```
errorCatalogException: ErrorCatalogException = httpProcessorException(ErrorCatalogCodes.ERROR_TYPE,
"Error message here...")
```
- GRPC Error Exception
```
errorCatalogException: ErrorCatalogException = grpcProcessorException(ErrorCatalogCodes.ERROR_TYPE,
"Error message here...")
```
##### 3. Update an existing exception
```
e = errorCatalogException.code(500)
e = errorCatalogException.action("message")
...
```
##### 4. Add a HTTP REST Exception handler
@RestControllerAdvice("domain.here")
open class ExceptionHandler(private val errorCatalogService: ErrorCatalogService) :
ErrorCatalogExceptionHandler(errorCatalogService)
|