ControllerBP logs errors 50/94050/1
authorOleg Mitsura <oleg.mitsura@amdocs.com>
Wed, 21 Aug 2019 15:52:10 +0000 (11:52 -0400)
committerOleg Mitsura <oleg.mitsura@amdocs.com>
Wed, 21 Aug 2019 15:56:13 +0000 (11:56 -0400)
Issue-ID: CCSDK-1630

Signed-off-by: Oleg Mitsura <oleg.mitsura@amdocs.com>
Change-Id: Ie5e9ca67cc2e0aa9b1a36a7b13372687a94a71e7

ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExceptionHandler.kt [moved from ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt with 78% similarity]

@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
 import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode
 import org.onap.ccsdk.cds.controllerblueprints.service.common.ErrorMessage
+import org.slf4j.LoggerFactory
 import org.springframework.http.HttpStatus
 import org.springframework.http.ResponseEntity
 import org.springframework.web.bind.annotation.ExceptionHandler
@@ -32,19 +33,26 @@ import org.springframework.web.bind.annotation.ExceptionHandler
  * @version 1.0
  */
 @RestControllerAdvice("org.onap.ccsdk.cds.controllerblueprints")
-open class ControllerBlueprintExeptionHandler {
+open class ControllerBlueprintExceptionHandler {
+
+    companion object ControllerBlueprintExeptionHandler {
+        val LOG = LoggerFactory.getLogger(ControllerBlueprintExceptionHandler::class.java)
+    }
 
     @ExceptionHandler
-    fun ControllerBlueprintException(e: BluePrintException): ResponseEntity<ErrorMessage> {
+    fun ControllerBlueprintExceptionHandler(e: BluePrintException): ResponseEntity<ErrorMessage> {
         var errorCode = ErrorCode.valueOf(e.code)
         val errorMessage = ErrorMessage(errorCode?.message(e.message!!), errorCode?.value, "ControllerBluePrint_Error_Message")
+        LOG.error("Error: $errorCode ${e.message}")
         return ResponseEntity(errorMessage, HttpStatus.resolve(errorCode!!.httpCode))
     }
 
     @ExceptionHandler
-    fun ControllerBlueprintException(e: Exception): ResponseEntity<ErrorMessage> {
+    fun ControllerBlueprintExceptionHandler(e: Exception): ResponseEntity<ErrorMessage> {
         var errorCode = ErrorCode.GENERIC_FAILURE
         val errorMessage = ErrorMessage(errorCode?.message(e.message!!), errorCode?.value, "ControllerBluePrint_Error_Message")
+        LOG.error("Error: $errorCode ${e.message}")
         return ResponseEntity(errorMessage, HttpStatus.resolve(errorCode!!.httpCode))
     }
-}
\ No newline at end of file
+}
+