com.capitalone.dashboard.rest.RestApiExceptionHandler Maven / Gradle / Ivy
package com.capitalone.dashboard.rest;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.validation.BindException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import com.capitalone.dashboard.Application;
import com.capitalone.dashboard.auth.exceptions.DeleteLastAdminException;
import com.capitalone.dashboard.auth.exceptions.UserNotFoundException;
import com.capitalone.dashboard.misc.HygieiaException;
import com.capitalone.dashboard.model.ErrorResponse;
import com.capitalone.dashboard.util.UnsafeDeleteException;
import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException;
/**
* Controller advice to handle exceptions globally.
*/
@EnableWebMvc
@ControllerAdvice(annotations = RestController.class, basePackageClasses = Application.class)
public class RestApiExceptionHandler extends ResponseEntityExceptionHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(RestApiExceptionHandler.class);
@Override
protected ResponseEntity
© 2015 - 2025 Weber Informatics LLC | Privacy Policy