HeaderPrintWriter errorStream = Monitor.getStream();
if (errorStream == null) {
se.printStackTrace();
return;
}
ErrorStringBuilder errorStringBuilder = new ErrorStringBuilder(errorStream.getHeader());
errorStringBuilder.append("\nERROR " + se.getSQLState() + ": " + se.getMessage() + "\n");
errorStringBuilder.stackTrace(se);
errorStream.print(errorStringBuilder.get().toString());
errorStream.flush();
errorStringBuilder.reset();
}