private void error(String message, Throwable t, HttpServletResponse response) throws IOException { if (t != null) log.error(message, t); else log.error(message); if (response.isCommitted()) { log.error("Could not write an error message as the headers & HTTP status were already committed!"); } else { response.setStatus(500); StreamWriter sw = getAbdera().newStreamWriter().setOutputStream(response.getOutputStream(), "UTF-8"); Error.create(sw, 500, message, t); sw.close(); } }