public static void renderException ( final Exception ex , final HttpServletResponse response ) { val map = new HashMap < String , String > ( ) ; map . put ( "error" , ex . getMessage ( ) ) ; map . put ( "stacktrace" , Arrays . deepToString ( ex . getStackTrace ( ) ) ) ; renderException ( map , response ) ; }
Render exceptions . Adds error messages and the stack trace to the json model and sets the response status accordingly to note bad requests .