public class QuimpException extends Exception
Allow for handling them and present to user depending on QuimpException.MessageSinkTypes
.
Modifier and Type | Class and Description |
---|---|
static class |
QuimpException.MessageSinkTypes
Define where the message should be displayed.
|
Modifier and Type | Field and Description |
---|---|
ch.qos.logback.classic.Logger |
logger
The LOGGER.
|
protected EnumSet<QuimpException.MessageSinkTypes> |
messageSinkType
Message sinks - where they will appear.
|
protected boolean |
persistent
If true sink type will not be changed in
setMessageSinkType(MessageSinkTypes...) and
setMessageSinkType(Set) . |
Constructor and Description |
---|
QuimpException()
Default constructor, set message sink to console.
|
QuimpException(QuimpException.MessageSinkTypes... types)
Allow to set type of message, where it should be displayed.
|
QuimpException(QuimpException.MessageSinkTypes type)
Allow to set type of message, where it should be displayed.
|
QuimpException(String message)
Default exception with message.
|
QuimpException(String message,
QuimpException.MessageSinkTypes... types)
Exception with message.
|
QuimpException(String message,
QuimpException.MessageSinkTypes type)
Exception with message.
|
QuimpException(String message,
QuimpException.MessageSinkTypes type,
boolean persistent)
Exception with message.
|
QuimpException(String message,
Throwable cause)
QuimpException.
|
QuimpException(String message,
Throwable cause,
boolean enableSuppression,
boolean writableStackTrace)
QuimpException.
|
QuimpException(String message,
Throwable cause,
QuimpException.MessageSinkTypes... types)
QuimpException.
|
QuimpException(String message,
Throwable cause,
QuimpException.MessageSinkTypes type)
QuimpException.
|
QuimpException(Throwable cause)
QuimpException.
|
QuimpException(Throwable cause,
QuimpException.MessageSinkTypes... types)
QuimpException.
|
QuimpException(Throwable cause,
QuimpException.MessageSinkTypes type)
QuimpException.
|
Modifier and Type | Method and Description |
---|---|
static List<String> |
getExceptionMessageChain(Throwable throwable)
Get messages from exception stack.
|
Set<QuimpException.MessageSinkTypes> |
getMessageSinkType()
Get message sink.
|
String |
handleException(Frame frame,
String appendMessage)
Handle this exception displaying it and logging depending on
messageSinkType . |
static String |
prepareMessage(Exception ex,
String appendMessage)
Prepare formatted message to show.
|
void |
setMessageSinkType(QuimpException.MessageSinkTypes... messageSinkType)
Set message sink.
|
void |
setMessageSinkType(Set<QuimpException.MessageSinkTypes> messageSinkType)
Set message sink.
|
static void |
showGuiWithMessage(Frame frame,
String message)
Show UI with message.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
protected boolean persistent
setMessageSinkType(MessageSinkTypes...)
and
setMessageSinkType(Set)
.public ch.qos.logback.classic.Logger logger
protected EnumSet<QuimpException.MessageSinkTypes> messageSinkType
QuimpException.MessageSinkTypes
public QuimpException()
public QuimpException(QuimpException.MessageSinkTypes... types)
types
- of message (list)QuimpException.MessageSinkTypes
public QuimpException(QuimpException.MessageSinkTypes type)
type
- of message (one)QuimpException.MessageSinkTypes
public QuimpException(String message)
message
- messagepublic QuimpException(String message, QuimpException.MessageSinkTypes type)
message
- messagetype
- where to show messagepublic QuimpException(String message, QuimpException.MessageSinkTypes type, boolean persistent)
message
- messagetype
- where to show messagepersistent
- if true the sink will not be overwrittenpublic QuimpException(String message, QuimpException.MessageSinkTypes... types)
message
- messagetypes
- where to show messagepublic QuimpException(Throwable cause)
cause
- causepublic QuimpException(Throwable cause, QuimpException.MessageSinkTypes type)
cause
- causetype
- type (one)public QuimpException(Throwable cause, QuimpException.MessageSinkTypes... types)
cause
- causetypes
- type (list)public QuimpException(String message, Throwable cause)
message
- messagecause
- causepublic QuimpException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace)
message
- messagecause
- causeenableSuppression
- enableSuppressionwritableStackTrace
- writableStackTracepublic QuimpException(String message, Throwable cause, QuimpException.MessageSinkTypes type)
message
- messagecause
- causetype
- where to show message (one)public QuimpException(String message, Throwable cause, QuimpException.MessageSinkTypes... types)
message
- messagecause
- causetypes
- where to show message (list)public void setMessageSinkType(QuimpException.MessageSinkTypes... messageSinkType)
QuimpException.MessageSinkTypes
values.messageSinkType
- the messageSinkType to set.public void setMessageSinkType(Set<QuimpException.MessageSinkTypes> messageSinkType)
QuimpException.MessageSinkTypes
values.messageSinkType
- the messageSinkType to set.public Set<QuimpException.MessageSinkTypes> getMessageSinkType()
public String handleException(Frame frame, String appendMessage)
messageSinkType
.frame
- Swing frame to display message for user, can be nullappendMessage
- Message added to beginning of the exception message, can be ""public static void showGuiWithMessage(Frame frame, String message)
frame
- Swing frame to display message for user, can be nullmessage
- message produced by prepareMessage(Exception, String)
public static String prepareMessage(Exception ex, String appendMessage)
ex
- Exception to dig in.appendMessage
- Message added to beginning of the exception message, can be ""Copyright © 2002–2019 Department of Computer Science, Warwick University. All rights reserved.