public class ExceptionWithContext
extends java.lang.RuntimeException
| Constructor and Description |
|---|
ExceptionWithContext(java.lang.String message,
java.lang.Object... formatArgs)
Constructs an instance.
|
ExceptionWithContext(java.lang.Throwable cause)
Constructs an instance.
|
ExceptionWithContext(java.lang.Throwable cause,
java.lang.String message,
java.lang.Object... formatArgs)
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addContext(java.lang.String str)
Adds a line of context to this instance.
|
java.lang.String |
getContext()
Gets the context.
|
void |
printContext(java.io.PrintStream out)
Prints the message and context.
|
void |
printContext(java.io.PrintWriter out)
Prints the message and context.
|
void |
printStackTrace(java.io.PrintStream out) |
void |
printStackTrace(java.io.PrintWriter out) |
static ExceptionWithContext |
withContext(java.lang.Throwable ex,
java.lang.String str,
java.lang.Object... formatArgs)
Augments the given exception with the given context, and return the
result.
|
public ExceptionWithContext(java.lang.String message,
java.lang.Object... formatArgs)
message - human-oriented messagepublic ExceptionWithContext(java.lang.Throwable cause)
cause - null-ok; exception that caused this onepublic ExceptionWithContext(java.lang.Throwable cause,
java.lang.String message,
java.lang.Object... formatArgs)
message - human-oriented messagecause - null-ok; exception that caused this onepublic static ExceptionWithContext withContext(java.lang.Throwable ex, java.lang.String str, java.lang.Object... formatArgs)
ExceptionWithContext, or a newly-constructed exception if it
was not.ex - non-null; the exception to augmentstr - non-null; context to addpublic void printStackTrace(java.io.PrintStream out)
printStackTrace in class java.lang.Throwablepublic void printStackTrace(java.io.PrintWriter out)
printStackTrace in class java.lang.Throwablepublic void addContext(java.lang.String str)
str - non-null; new contextpublic java.lang.String getContext()
public void printContext(java.io.PrintStream out)
out - non-null; where to print topublic void printContext(java.io.PrintWriter out)
out - non-null; where to print to