public class ExceptionWithContext extends RuntimeException
| Constructor and Description |
|---|
ExceptionWithContext(String message)
Constructs an instance.
|
ExceptionWithContext(String message,
Throwable cause)
Constructs an instance.
|
ExceptionWithContext(Throwable cause)
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addContext(String str)
Adds a line of context to this instance.
|
String |
getContext()
Gets the context.
|
void |
printContext(PrintStream out)
Prints the message and context.
|
void |
printContext(PrintWriter out)
Prints the message and context.
|
void |
printStackTrace(PrintStream out) |
void |
printStackTrace(PrintWriter out) |
static ExceptionWithContext |
withContext(Throwable ex,
String str)
Augments the given exception with the given context, and return the
result.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace, toStringpublic ExceptionWithContext(String message)
message - human-oriented messagepublic ExceptionWithContext(Throwable cause)
cause - null-ok; exception that caused this onepublic static ExceptionWithContext withContext(Throwable ex, String str)
ExceptionWithContext, or a newly-constructed exception if it
was not.ex - non-null; the exception to augmentstr - non-null; context to addnon-null; an appropriate instancepublic void printStackTrace(PrintStream out)
printStackTrace in class Throwablepublic void printStackTrace(PrintWriter out)
printStackTrace in class Throwablepublic void addContext(String str)
str - non-null; new contextpublic String getContext()
non-null; the contextpublic void printContext(PrintStream out)
out - non-null; where to print topublic void printContext(PrintWriter out)
out - non-null; where to print toCopyright © 2016. All Rights Reserved.