|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
net.protempore.utils.BaseRuntimeException
public class BaseRuntimeException
A base runtime exception class that provides 2 additional conveniences: 1) it allows a variable number of arguments to
be given in addition to the message, which will be interpolated into the message if there is at least 1; 2) there are
overloaded constructors allowing for an array of Throwable instead of just a single
Throwable, which is useful when an exception may only be thrown at the end of a method, and multiple
underlying exceptions may be the cause of the end exception thrown.
Example: instead of needing to do:
throw new BaseRuntimeException(origExc, "The baz with id '" + id + "' and name '" + name, "' is foo bar.")
you can do the simpler:
throw new BaseRuntimeException(origExc, "The baz with id '%s' and name '%s' is foo bar."), id, name)
In case of an exception occurring while interpolating the message, the original message string will be used and error output will be printed to standard error, since we do not want to introduce a logger dependency by logging the problem.
| Constructor Summary | |
|---|---|
BaseRuntimeException()
Create a new exception that specifies no message or cause. |
|
BaseRuntimeException(java.util.List<? extends java.lang.Throwable> causes)
Create a new exception with the given causes. |
|
BaseRuntimeException(java.util.List<? extends java.lang.Throwable> causes,
java.lang.String msg,
java.lang.Object... args)
Create new exception with the given error message and causes. |
|
BaseRuntimeException(java.lang.String msg,
java.lang.Object... args)
Create a new exception with the given error message, interpolating the args into the msg string if there are any. |
|
BaseRuntimeException(java.lang.Throwable cause)
Create a new exception with the given cause. |
|
BaseRuntimeException(java.lang.Throwable cause,
java.lang.String msg,
java.lang.Object... args)
Create new exception with the given error message and cause. |
|
| Method Summary | |
|---|---|
java.util.List<? extends java.lang.Throwable> |
getCauses()
Get all the underlying causes if any, or else the empty list. |
java.util.List<java.lang.String> |
getMessages()
A convenience method that returns a list consisting of this exception's message and the messages of all its causes. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Throwable |
|---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public BaseRuntimeException()
public BaseRuntimeException(java.lang.String msg,
java.lang.Object... args)
msg - A message.args - Any number of message arguments (in accordance with msg string).public BaseRuntimeException(java.lang.Throwable cause)
cause - The underlying cause of this exception.public BaseRuntimeException(java.util.List<? extends java.lang.Throwable> causes)
Throwable.getCause() will return. All causes may be retrieved using getCauses().
causes - The underlying causes of this exception.
public BaseRuntimeException(java.lang.Throwable cause,
java.lang.String msg,
java.lang.Object... args)
msg - An error message.args - Any number of message arguments (in accordance with msg string).cause - The underlying cause of this exception.
public BaseRuntimeException(java.util.List<? extends java.lang.Throwable> causes,
java.lang.String msg,
java.lang.Object... args)
causes - The underlying causes of this exception (must be non-null and have at least 1 item).msg - An error message.args - Any number of message arguments (in accordance with msg string).| Method Detail |
|---|
public java.util.List<? extends java.lang.Throwable> getCauses()
public java.lang.String toString()
toString in class java.lang.Throwablepublic java.util.List<java.lang.String> getMessages()
BaseRuntimeException with multiple causes).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||