io.vanillabp.cockpit.commons.exceptions.RestfulExceptionHandler Maven / Gradle / Ivy
package io.vanillabp.cockpit.commons.exceptions;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
@ControllerAdvice
public class RestfulExceptionHandler {
public static class RestError {
public int code;
}
@Autowired
private Logger logger;
@ExceptionHandler(BcValidationException.class)
public ResponseEntity