public static ModelAndView writeError(final HttpServletResponse response,
                                          final String error, final String description) {
        val model = getErrorResponseBody(error, description);
        val mv = new ModelAndView(new MappingJackson2JsonView(MAPPER), model);
        mv.setStatus(HttpStatus.BAD_REQUEST);
        response.setStatus(HttpStatus.BAD_REQUEST.value());
        return mv;
    }
Write error model and view.

@param response    the response
@param error       the error
@param description the description
@return the model and view
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/util/OAuth20Utils.java