Search in sources :

Example 1 with RestErrorCode

use of alien4cloud.rest.model.RestErrorCode in project alien4cloud by alien4cloud.

the class RestTechnicalExceptionHandler method paaSDeploymentErrorHandler.

@ExceptionHandler(value = PaaSDeploymentException.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ResponseBody
public RestResponse<Void> paaSDeploymentErrorHandler(PaaSDeploymentException e) {
    log.warn("Error in PaaS Deployment", e);
    RestErrorCode errorCode = RestErrorCode.APPLICATION_DEPLOYMENT_ERROR;
    if (e.getPassErrorCode() != null) {
        errorCode = e.getPassErrorCode();
    }
    return RestResponseBuilder.<Void>builder().error(RestErrorBuilder.builder(errorCode).message("Application cannot be deployed " + e.getMessage()).build()).build();
}
Also used : RestErrorCode(alien4cloud.rest.model.RestErrorCode) ExceptionHandler(org.springframework.web.bind.annotation.ExceptionHandler) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

RestErrorCode (alien4cloud.rest.model.RestErrorCode)1 ExceptionHandler (org.springframework.web.bind.annotation.ExceptionHandler)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)1