Package com.compomics.util.exceptions
Class ExceptionHandler
java.lang.Object
com.compomics.util.exceptions.ExceptionHandler
- Direct Known Subclasses:
CommandLineExceptionHandler
,FrameExceptionHandler
,WaitingDialogExceptionHandler
public abstract class ExceptionHandler extends Object
Interface for the general handling of exceptions.
- Author:
- Marc Vaudel
-
Field Summary
Fields Modifier and Type Field Description protected HashSet<String>
exceptionCaught
List of caught exceptions.protected boolean
ignoreExceptions
If true exceptions will be ignored. -
Constructor Summary
Constructors Constructor Description ExceptionHandler()
Empty default constructor -
Method Summary
Modifier and Type Method Description void
catchException(Exception e)
Catches an exception and informs the user.static String
getExceptionType(Exception e)
Returns the exception type.protected abstract void
notifyUser(Exception e)
Notifies the user that an exception was caught.void
setIgnoreExceptions(boolean ignoreExceptions)
Sets whether exceptions should be ignored.
-
Field Details
-
exceptionCaught
List of caught exceptions. -
ignoreExceptions
protected boolean ignoreExceptionsIf true exceptions will be ignored.
-
-
Constructor Details
-
ExceptionHandler
public ExceptionHandler()Empty default constructor
-
-
Method Details
-
catchException
Catches an exception and informs the user.- Parameters:
e
- the exception caught
-
notifyUser
Notifies the user that an exception was caught.- Parameters:
e
- the exception to catch
-
getExceptionType
Returns the exception type.- Parameters:
e
- the exception to get the type fro- Returns:
- the exception type as a string
-
setIgnoreExceptions
public void setIgnoreExceptions(boolean ignoreExceptions)Sets whether exceptions should be ignored.- Parameters:
ignoreExceptions
- if true exceptions will be ignored
-