Class ControllerException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.deltava.util.ControllerException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CommandException
,DAOException
,GenericServlet.ForbiddenException
,GenericServlet.NotFoundException
,ServiceException
An exception class to define a common singure for exceptions handled by the Command
Controller servlet.
- Since:
- 1.0
- Version:
- 11.2
- Author:
- Luke
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new controller exception with a given message.ControllerException
(String msg, Throwable t) Create a new ControllerException with an error message and underlying cause.Wraps a thrown exception. -
Method Summary
Modifier and TypeMethodDescriptionReturns the URL that the Controller servlet should forward the request to.boolean
Returns whether the handling class should log this Exception's stack trace.int
Returns the HTTP status code to set on the error page.boolean
Returns whether this exception should not be logged.boolean
Returns whether this exception to be logged as a warning, not an error.void
setForwardURL
(String url) Updates the URL that the Controller servlet should forward the request to.void
setLogStackDump
(boolean doLog) Updates whether the handling class should log this Exception's stack trace.void
setStatusCode
(int code) Sets the HTTP status code to set on the error page.void
setSuppressed
(boolean isSuppress) Sets this exception to not be logged.void
setWarning
(boolean isWarn) Sets this exception to be logged as a warning, not an error.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ControllerException
Wraps a thrown exception. This assumes the stack trace of the original execption.- Parameters:
t
- the thrown exception to wrap- See Also:
-
ControllerException
Creates a new controller exception with a given message.- Parameters:
msg
- the message for the exception
-
ControllerException
-
-
Method Details
-
getLogStackDump
public boolean getLogStackDump()Returns whether the handling class should log this Exception's stack trace.- Returns:
- TRUE if the stack trace should be logged, otherwise FALSE
- See Also:
-
getForwardURL
Returns the URL that the Controller servlet should forward the request to.- Returns:
- the URL to forward to, or null
- See Also:
-
isWarning
public boolean isWarning()Returns whether this exception to be logged as a warning, not an error.- Returns:
- TRUE if a warning, otherwise FALSE
- See Also:
-
isSuppressed
public boolean isSuppressed()Returns whether this exception should not be logged.- Returns:
- TRUE if not logged, otherwise FALSE
- See Also:
-
getStatusCode
public int getStatusCode()Returns the HTTP status code to set on the error page.- Returns:
- the HTTP status code
- See Also:
-
setLogStackDump
public void setLogStackDump(boolean doLog) Updates whether the handling class should log this Exception's stack trace.- Parameters:
doLog
- TRUE if the stack trace should be logged, otherwise FALSE- See Also:
-
setForwardURL
Updates the URL that the Controller servlet should forward the request to.- Parameters:
url
- the URL to forward to- See Also:
-
setWarning
public void setWarning(boolean isWarn) Sets this exception to be logged as a warning, not an error.- Parameters:
isWarn
- TRUE if a warning, otherwise FALSE- See Also:
-
setSuppressed
public void setSuppressed(boolean isSuppress) Sets this exception to not be logged.- Parameters:
isSuppress
- TRUE if suppressed, otherwise FALSE- See Also:
-
setStatusCode
public void setStatusCode(int code) Sets the HTTP status code to set on the error page.- Parameters:
code
- the HTTP status code- See Also:
-