All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.capitalone.dashboard.exception.ExceptionHandlerAdvice Maven / Gradle / Ivy

package com.capitalone.dashboard.exception;

import com.capitalone.dashboard.model.AuditException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class ExceptionHandlerAdvice {
    private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionHandlerAdvice.class);
    @ExceptionHandler(AuditException.class)
    public ResponseEntity handleException(AuditException e) {
        LOGGER.error("Bad request: " + e.getMessage());
        return ResponseEntity
                .status(HttpStatus.BAD_REQUEST)
                .body("Bad request: " + e.getMessage());
    }
}







© 2015 - 2024 Weber Informatics LLC | Privacy Policy