X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ms%2Fblueprintsprocessor%2Fmodules%2Finbounds%2Fresource-api%2Fsrc%2Fmain%2Fkotlin%2Forg%2Fonap%2Fccsdk%2Fcds%2Fblueprintsprocessor%2Fresource%2Fapi%2FResourceExceptionHandler.kt;h=5d5623d4f95ab6c792c7b89442dc86341c1b1d69;hb=341db21b2ac0a14a1ed2b8bf7930914dda054bfe;hp=42ff8016c56198ee0126257b7bb3c014e936b018;hpb=d274e5fc552cf9ae25500f504f0434981cf3accf;p=ccsdk%2Fcds.git diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceExceptionHandler.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceExceptionHandler.kt index 42ff8016c..5d5623d4f 100644 --- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceExceptionHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceExceptionHandler.kt @@ -23,16 +23,16 @@ import com.fasterxml.jackson.annotation.JsonTypeName import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode import org.slf4j.LoggerFactory +import org.springframework.dao.EmptyResultDataAccessException +import org.springframework.dao.IncorrectResultSizeDataAccessException import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity import org.springframework.orm.jpa.JpaObjectRetrievalFailureException -import org.springframework.dao.EmptyResultDataAccessException -import org.springframework.dao.IncorrectResultSizeDataAccessException -import org.springframework.web.server.ServerWebInputException import org.springframework.web.bind.annotation.ExceptionHandler import org.springframework.web.bind.annotation.RestControllerAdvice +import org.springframework.web.server.ServerWebInputException import java.io.Serializable -import java.util.* +import java.util.Date /** * Handle exceptions in Resolution API and provide relevant HTTP status codes and messages @@ -86,9 +86,11 @@ open class ResourceExceptionHandler { fun returnError(e: Exception, errorCode: ErrorCode): ResponseEntity { log.error(e.message, e) val errorMessage = - ErrorMessage(errorCode.message(e.message!!), + ErrorMessage( + errorCode.message(e.message!!), errorCode.value, - debugMsg) + debugMsg + ) return ResponseEntity(errorMessage, HttpStatus.resolve(errorCode.httpCode)!!) } @@ -103,6 +105,7 @@ open class ResourceExceptionHandler { @JsonTypeName("errorMessage") @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME) class ErrorMessage(var message: String?, var code: Int?, var debugMessage: String?) : Serializable { + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") var timestamp = Date() -} \ No newline at end of file +}