public class ExceptionManager extends Object
Modifier and Type | Method and Description |
---|---|
static RuntimeException |
asSafe(Throwable problem)
Wrap a
Throwable in a RuntimeException . |
static void |
printStackTrace(Throwable problem)
Prints a
Throwable and its backtrace to the standard error
stream in way that knows about non-local exceptions. |
static void |
printStackTrace(Throwable problem,
PrintStream out)
Prints a
Throwable and its backtrace to the specified print
stream in way that knows about non-local exceptions. |
static void |
printStackTrace(Throwable problem,
PrintStream out,
boolean nonLocal)
Prints a
Throwable and its backtrace to the specified print
stream in way that knows about non-local exceptions. |
static void |
reportException(Throwable problem)
Handle an exception, either by printing its stack trace to the standard
error stream or, if an
ExceptionNoticer has been registered, by
informing the ExceptionNoticer . |
static void |
reportException(Throwable problem,
boolean nonLocal)
Handle an exception, either by printing its stack trace to the standard
error stream or, if an
ExceptionNoticer has been registered, by
informing the ExceptionNoticer . |
static void |
reportException(Throwable problem,
String msg)
Handle an exception, either by printing its stack trace to the standard
error stream or, if an
ExceptionNoticer has been registered, by
informing the ExceptionNoticer . |
static void |
reportException(Throwable problem,
String msg,
boolean nonLocal)
Handle an exception, either by printing its stack trace to the standard
error stream or, if an
ExceptionNoticer has been registered, by
informing the ExceptionNoticer . |
static void |
setExceptionNoticer(ExceptionNoticer noticer)
Register an
ExceptionNoticer to be informed whenever one of the
reportException() methods is called. |
static void |
uncaughtException(Thread thread,
Throwable problem)
Report an uncaught exception.
|
public static RuntimeException asSafe(Throwable problem)
Throwable
in a RuntimeException
.Wraps problem if necessary so that the caller can do a
throw ExceptionMgr.asSafe(problem);without having to declare any new "throws" cases. The caller does the throw rather than this method so that the Java compiler will have better control flow information.
problem
- The Throwable
to wrappublic static void printStackTrace(Throwable problem)
Throwable
and its backtrace to the standard error
stream in way that knows about non-local exceptions.problem
- The Throwable
to print a stack trace for.public static void printStackTrace(Throwable problem, PrintStream out)
Throwable
and its backtrace to the specified print
stream in way that knows about non-local exceptions.problem
- The Throwable
to print a stack trace for.out
- Print stream to print it on.public static void printStackTrace(Throwable problem, PrintStream out, boolean nonLocal)
Throwable
and its backtrace to the specified print
stream in way that knows about non-local exceptions.problem
- The Throwable
to print a stack trace for.out
- Print stream to print it onnonLocal
- If true, also report the site from which the
stack trace is being printed.public static void reportException(Throwable problem)
ExceptionNoticer
has been registered, by
informing the ExceptionNoticer
. The exception is considered
local.problem
- The Throwable
to report.public static void reportException(Throwable problem, String msg)
ExceptionNoticer
has been registered, by
informing the ExceptionNoticer
. The exception is considered
local.problem
- The Throwable
to report.msg
- Error message to accompany the report.public static void reportException(Throwable problem, String msg, boolean nonLocal)
ExceptionNoticer
has been registered, by
informing the ExceptionNoticer
.problem
- The Throwable
to report.msg
- Error message to accompany the report.nonLocal
- If true, also report the site from which the
stack trace is being printed.public static void reportException(Throwable problem, boolean nonLocal)
ExceptionNoticer
has been registered, by
informing the ExceptionNoticer
.problem
- The Throwable
to report.nonLocal
- If true, also report the site from which the
stack trace is being printed.public static void setExceptionNoticer(ExceptionNoticer noticer)
ExceptionNoticer
to be informed whenever one of the
reportException() methods is called.noticer
- The noticer to call.Copyright © 2017. All rights reserved.