java.lang.Object
com.aoapps.lang.util.ErrorPrinter
Prints errors with more detail than a standard printStackTrace() call. Is also able to
capture the error into a
String.
TODO: Avoid repetitive sequences of stack traces to reduce total output length.
TODO: Make an extensible way to register additional error printer features, and
automatically load them via ServiceLoader. Maybe spin this off to a
microproject if we go this far.
- Author:
- AO Industries, Inc.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic voidAdds a new mapping between a throwable and the statement that caused it.static voidaddSql(Throwable t, PreparedStatement pstmt) Adds a new mapping between a throwable and the statement that caused it.static voidDeprecated.static voidaddSQL(Throwable t, PreparedStatement pstmt) Deprecated.Please useaddSql(java.lang.Throwable, java.sql.PreparedStatement)instead.Gets the mappings between the given throwable and any statements that caused it.Deprecated.Please usegetSql(java.lang.Throwable)instead.static StringGets the entire exception report as aString.static StringgetStackTraces(Throwable thrown, Object... extraInfo) Gets the entire exception report as aString.static voidDeprecated.static voidprintStackTraces(Throwable t, Appendable out) static voidprintStackTraces(Throwable thrown, Appendable out, Object... extraInfo) Prints a detailed error report, including all stack traces, to the provided out.static voidprintStackTraces(Throwable t, Object... extraInfo) Deprecated.
-
Method Details
-
addSql
Adds a new mapping between a throwable and the statement that caused it.- Parameters:
sql- The SQL statement that caused the exception.
-
addSql
Adds a new mapping between a throwable and the statement that caused it.- Parameters:
pstmt- The SQL statement that caused the exception. This must provide the SQL statement fromPreparedStatement.toString(), which the PostgreSQL JDBC driver does.
-
addSQL
Deprecated.Please useaddSql(java.lang.Throwable, java.lang.String)instead.Adds a new mapping between a throwable and the statement that caused it.- Parameters:
sql- The SQL statement that caused the exception.
-
addSQL
Deprecated.Please useaddSql(java.lang.Throwable, java.sql.PreparedStatement)instead.Adds a new mapping between a throwable and the statement that caused it.- Parameters:
pstmt- The SQL statement that caused the exception. This must provide the SQL statement fromPreparedStatement.toString(), which the PostgreSQL JDBC driver does.
-
getSql
Gets the mappings between the given throwable and any statements that caused it.- Returns:
- The SQL statements that caused the exception or an empty list when none.
-
getSQL
Deprecated.Please usegetSql(java.lang.Throwable)instead.Gets the mappings between the given throwable and any statements that caused it.- Returns:
- The SQL statements that caused the exception or an empty list when none.
-
printStackTraces
Deprecated. -
printStackTraces
Deprecated. -
printStackTraces
-
printStackTraces
Prints a detailed error report, including all stack traces, to the provided out. Synchronizes on out to make sure concurrently reported errors will not be mixed. If out isFlushable, will flush the output. -
addCustomMessageHandler
-
getStackTraces
Gets the entire exception report as aString. This is not as efficient as directly writing the report due to the extra buffering. -
getStackTraces
Gets the entire exception report as aString. This is not as efficient as directly writing the report due to the extra buffering.
-

addSql(java.lang.Throwable, java.lang.String)instead.