diff options
Diffstat (limited to 'ms/error-catalog/README.md')
-rwxr-xr-x | ms/error-catalog/README.md | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/ms/error-catalog/README.md b/ms/error-catalog/README.md new file mode 100755 index 000000000..1df859574 --- /dev/null +++ b/ms/error-catalog/README.md @@ -0,0 +1,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)
\ No newline at end of file |