public class GeneralException extends Exception
| Modifier and Type | Field and Description |
|---|---|
static int |
ERROR
Constant denoting an error
|
protected int |
errorCode
The error code
|
protected String |
errorMessage
The error message
|
protected boolean |
exceptionIsLogged
logged exception flag
|
protected int |
exceptionSeriousCode
the serious exception code
|
static int |
FATAL_ERROR
Constant denoting a fatal error
|
protected boolean |
logException
log exception flag
|
protected Throwable |
originalException
the original exception
|
protected int |
subSystem
The sub system
|
static int |
WARNING
Constant denoting a warning
|
| Constructor and Description |
|---|
GeneralException()
Default empty constructor
|
GeneralException(int errorCode,
String errorMessage,
int subsystem,
boolean shouldBeLogged,
int seriousness,
Throwable originalException)
Construcuts a new GeneralException.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
exceptionLogged()
Returns true if the exception has been logged
|
int |
exceptionSeriousness()
Returns the seriousnes of exception.
|
String |
exceptionSeriousnessToString()
Returns the seriousnes of exception as a string
|
int |
getErrorCode()
Returns error code.
|
String |
getErrorMessage()
Returns error message.
|
String |
getMessage() |
Throwable |
getOriginalException()
Returns the original error which triggered this exception, if it
exist
|
int |
getSubSystem()
Returns subsystem where this error occured.
|
protected void |
log()
Override this to make your own logging mechanism
|
boolean |
shouldExceptionBeLogged()
Returns true if the exception should be logged
|
String |
toString() |
String |
toStringSuper()
Invokes toString method of the Exception class.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTraceprotected int errorCode
protected String errorMessage
protected int subSystem
protected boolean logException
protected boolean exceptionIsLogged
protected int exceptionSeriousCode
protected Throwable originalException
public static final int WARNING
public static final int ERROR
public static final int FATAL_ERROR
public GeneralException()
public GeneralException(int errorCode,
String errorMessage,
int subsystem,
boolean shouldBeLogged,
int seriousness,
Throwable originalException)
errorCode - The error code for the exception.errorMessage - The error message for the exception. This message is
to be displayed to the user, so it should be user-friendly.subsystem - The subsystem of where the exception originated.shouldBeLogged - Flags if the exception should be logged.seriousness - The seriousness of the exception. Should be one of
WARNING, ERROR or FATAL_ERROR.originalException - The exception leading to this exception, if any.public int getErrorCode()
public String getMessage()
getMessage in class Throwablepublic String getErrorMessage()
public int getSubSystem()
public boolean shouldExceptionBeLogged()
true if exception should be logged.public boolean exceptionLogged()
true if exception is logged.public int exceptionSeriousness()
public String exceptionSeriousnessToString()
public Throwable getOriginalException()
protected void log()
public String toStringSuper()
Throwable.toString()Copyright © 2006–2020 Esito AS. All rights reserved.