Package de.uzl.its.swat.common
Class ErrorHandler
java.lang.Object
de.uzl.its.swat.common.ErrorHandler
ErrorHandler is responsible for handling exceptions throughout the application. It decides
whether to log the error or terminate the execution based on the application configuration.
-
Constructor Summary
ConstructorDescriptionConstructs an ErrorHandler with a specified Config and ILogger implementation. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Handles an exception by logging it with a default message.void
handleException
(String msg, Throwable t) Handles an exception with a custom message.
-
Constructor Details
-
ErrorHandler
public ErrorHandler()Constructs an ErrorHandler with a specified Config and ILogger implementation.
-
-
Method Details
-
handleException
Handles an exception by logging it with a default message. The action taken depends on the application configuration.- Parameters:
e
- the exception to handle
-
handleException
Handles an exception with a custom message. Depending on the application configuration, it either logs the error or terminates the execution by throwing a RuntimeException.- Parameters:
msg
- the custom message to log along with the exceptiont
- the throwable to handle
-