|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Throwable java.lang.Exception java.lang.RuntimeException cz.cuni.amis.utils.exception.PogamutException
public class PogamutException
Ancestor of all exceptions of the Pogamut platform (except PogamutIOException and PogamutRuntimeException). It automatically logs the exception to the platform log of the respective agent were the exception occurred.
Note that Pogamut exceptions are storing the information whether they have been already logged + the instance of the object that has created (thrown) them.
Because of the 'origin' object you don't have to bother to prefix your exceptions with origin's name. All you have to care about is to have properly implemented toString() method of your objects so the messages looks pretty.
By design-choice, every PogamutException is RuntimeException - note that if exception is thrown you will probably just tore down everything or propagate it higher - no need to write throws to every method just because we want to state that something might throw an exception.
Constructor Summary | |
---|---|
PogamutException(java.lang.String message,
java.util.logging.Logger log,
java.lang.Object origin)
Constructs a new exception with the specified detail message. |
|
PogamutException(java.lang.String message,
java.lang.Object origin)
Constructs a new exception with the specified detail message. |
|
PogamutException(java.lang.String message,
java.lang.Throwable cause)
Constructs a new exception with the specified detail message. |
|
PogamutException(java.lang.String message,
java.lang.Throwable cause,
java.util.logging.Logger log,
java.lang.Object origin)
Constructs a new exception with the specified detail message and cause. |
|
PogamutException(java.lang.String message,
java.lang.Throwable cause,
java.lang.Object origin)
Constructs a new exception with the specified detail message and cause. |
|
PogamutException(java.lang.Throwable cause,
java.util.logging.Logger log,
java.lang.Object origin)
Constructs a new exception with the specified detail message and cause. |
|
PogamutException(java.lang.Throwable cause,
java.lang.Object origin)
Constructs exception based on the cause an origin. |
Method Summary | |
---|---|
java.lang.Object |
getOrigin()
Returns the object that has thrown the exception. |
boolean |
isLogged()
Whether the exception has been logged to any logger. |
void |
logException(java.util.logging.Logger log)
Logs the exception to the log + sets isLogged() to true. |
void |
logExceptionOnce(java.util.logging.Logger log)
Logs the exception to the log iff !isLogged(). |
void |
setLogged(boolean logged)
Set whether the exception has been logged to the Platform logger, if not it will be logged as soon as it encounters some catch block from the Pogamut platform. |
java.lang.String |
toString()
Serialize the exception to String. |
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 PogamutException(java.lang.Throwable cause, java.lang.Object origin)
cause
- origin
- may be nullpublic PogamutException(java.lang.String message, java.lang.Object origin)
Not logging anything anywhere on its own.
message
- origin
- which object does produced the exceptionpublic PogamutException(java.lang.String message, java.lang.Throwable cause)
Not logging anything anywhere on its own.
message
- cause
- public PogamutException(java.lang.String message, java.lang.Throwable cause, java.lang.Object origin)
Not logging anything anywhere on its own.
message
- cause
- origin
- object that thrown the exception, may be nullpublic PogamutException(java.lang.String message, java.util.logging.Logger log, java.lang.Object origin)
Logs the exception via specified Logger.
message
- origin
- which object does produced the exception, may be nullpublic PogamutException(java.lang.Throwable cause, java.util.logging.Logger log, java.lang.Object origin)
Logs the exception via specified Logger.
message
- cause
- origin
- object that thrown the exceptionpublic PogamutException(java.lang.String message, java.lang.Throwable cause, java.util.logging.Logger log, java.lang.Object origin)
Logs the exception via specified Logger.
message
- cause
- origin
- object that thrown the exception, may be nullMethod Detail |
---|
public boolean isLogged()
Note that sometimes it's not possible to log the exception as it is created due to lack of the logger - therefore we propagate this information through the stack and as soon as it encounters some Pogamut-platform catch block it will be logged.
public void setLogged(boolean logged)
logged
- public java.lang.Object getOrigin()
public java.lang.String toString()
toString
in class java.lang.Throwable
public void logException(java.util.logging.Logger log)
public void logExceptionOnce(java.util.logging.Logger log)
Logs the exception only once! Successive calls do nothing.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |