public final class Exceptions extends Object
Modifier and Type | Method and Description |
---|---|
static <E extends Throwable> |
attachLocalizedMessage(E e,
String localizedMessage)
Attaches additional localized message to given exception.
|
static <E extends Throwable> |
attachMessage(E e,
String msg)
Attaches additional message to given exception.
|
static <E extends Throwable> |
attachSeverity(E e,
Level severity)
Attaches a given severity to the exception.
|
static String |
findLocalizedMessage(Throwable t)
Extracts previously attached localized message for a given throwable.
|
static void |
printStackTrace(Throwable t)
Notifies an exception with a severe level.
|
public static <E extends Throwable> E attachMessage(E e, String msg)
e.printStackTrace()
.e
- exception to annotatemsg
- the message to add to the exceptione
public static <E extends Throwable> E attachLocalizedMessage(E e, String localizedMessage)
findLocalizedMessage(java.lang.Throwable)
.e
- exception to annotatelocalizedMessage
- the localized message to add to the exceptione
public static <E extends Throwable> E attachSeverity(E e, Level severity)
printStackTrace(java.lang.Throwable)
method, the level is
then used as a level for reported LogRecord
. This allows
those who report exceptions to annotate them as unimportant,
expected.e
- exception to assign severity toseverity
- the severitypublic static String findLocalizedMessage(Throwable t)
attachLocalizedMessage(E, java.lang.String)
.t
- the exception to search for a message innull
if no such message has been attachedpublic static void printStackTrace(Throwable t)
Since version 8.29 the default implementation of this method inside
a NetBeans Platform based application understands
UserQuestionException
. If the exception is thrown and later
reported via this method, it is properly shown to the user as a
dialog with approve/reject buttons. If approved, the infrastructure
calls UserQuestionException.confirmed()
method.
t
- the exception to notify