net.sourceforge.squirrel_sql.plugins.example
Class ExampleExceptionFormatter
java.lang.Object
net.sourceforge.squirrel_sql.plugins.example.ExampleExceptionFormatter
- All Implemented Interfaces:
- ExceptionFormatter
public class ExampleExceptionFormatter
- extends Object
- implements ExceptionFormatter
|
Method Summary |
String |
format(Throwable t)
In this example, we simply prefix the original exception message with a string that lets us know that
the Example plugin applied a custom format. |
boolean |
formatsException(Throwable t)
In this example if the throwable is not null, we say that we want to format it. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExampleExceptionFormatter
public ExampleExceptionFormatter()
format
public String format(Throwable t)
throws Exception
- In this example, we simply prefix the original exception message with a string that lets us know that
the Example plugin applied a custom format. In a real implementation, you might want to call the
getCause() method on the Throwable to determine if there were chained exceptions available to drill
down to the actual exception that contains the stack trace and message to the very first place in code
where an exception was encountered.
- Specified by:
format in interface ExceptionFormatter
- Throws:
Exception- See Also:
ExceptionFormatter.format(java.lang.Throwable)
formatsException
public boolean formatsException(Throwable t)
- In this example if the throwable is not null, we say that we want to format it. This lets SQuirreL
know that it should not apply it's own formatting, but rather use the format applied by this formatter's
format method. In a real implementation which is specific to a vendor's JDBC driver, the Throwable will
be a particular vendor type and probably has a package like com.{vendor}. Also, if the vendor adds
custom methods for accessing the message, they should be called using the Java reflection API so that
compiling this class does not require proprietary class libraries.
- Specified by:
formatsException in interface ExceptionFormatter
- See Also:
ExceptionFormatter.formatsException(java.lang.Throwable)
Copyright © 2001-2013. All Rights Reserved.