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