Skip to content
Snippets Groups Projects
Commit f1e0b96e authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Add separate exception handler for HttpMessageNotReadableException

parent 3f8f3a79
No related merge requests found
......@@ -26,6 +26,7 @@ import de.thm.arsnova.exceptions.PayloadTooLargeException;
import de.thm.arsnova.exceptions.PreconditionFailedException;
import de.thm.arsnova.exceptions.UnauthorizedException;
import org.springframework.http.HttpStatus;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException;
......@@ -126,4 +127,11 @@ public class ControllerExceptionHandler extends AbstractControllerExceptionHandl
public Map<String, Object> handlePayloadTooLargeException(final Exception e, final HttpServletRequest request) {
return handleException(e);
}
@ExceptionHandler(HttpMessageNotReadableException.class)
@ResponseBody
@ResponseStatus(HttpStatus.BAD_REQUEST)
public Map<String, Object> handleHttpMessageNotReadableException(final Exception e, final HttpServletRequest request) {
return handleException(e);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment