diff options
author | Dan Timoney <dtimoney@att.com> | 2019-08-22 22:08:45 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-08-22 22:08:45 +0000 |
commit | 219d032f0ae6a734d79cba5dba381123f7ef33c4 (patch) | |
tree | d625ba951bbba506ac039bb675e525d78a3308c0 | |
parent | d02e575d359c5a7707112e5e0afc53713d7796e7 (diff) | |
parent | bf4ee7e749c34192feb10f6ac50e7eb2015a4e26 (diff) |
Merge "ControllerBP logs errors"
-rw-r--r-- | ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExceptionHandler.kt (renamed from ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt) | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExceptionHandler.kt index de8ba93e3..5b92369f8 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt +++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExceptionHandler.kt @@ -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 +} + |