SudokuFX
Loading...
Searching...
No Matches
fr.softsf.sudokufx.common.exception.ExceptionTools Enum Reference

Utility enum for handling and analyzing exceptions. More...

Collaboration diagram for fr.softsf.sudokufx.common.exception.ExceptionTools:

Public Member Functions

SQLInvalidAuthorizationSpecException findSQLInvalidAuthException (Throwable e)
 Searches recursively through the exception chain to find the first SQLInvalidAuthorizationSpecException, starting from the given Throwable.
private< T extends Throwable > T logAndInstantiate (String message, Throwable cause, BiFunction< String, Throwable, T > factory, String defaultMsg, String logPrefix)
 Internal generic helper to centralize logging logic and exception instantiation.
FolderCreationException logAndInstantiateFolderCreation (String message)
 Logs an error and creates a FolderCreationException without a cause.
FolderCreationException logAndInstantiateFolderCreation (String message, Throwable cause)
 Logs an error and creates a FolderCreationException with an optional cause.
IllegalArgumentException logAndInstantiateIllegalArgument (String message)
 Logs the given message and returns an instance of IllegalArgumentException with it.
IllegalArgumentException logAndInstantiateIllegalArgument (String message, Throwable cause)
 Logs the message and cause, then returns an IllegalArgumentException.
IllegalStateException logAndInstantiateIllegalState (String message)
 Logs an error and returns an IllegalStateException.
LogbackConfigurationException logAndInstantiateLogbackConfig (String message, Throwable cause)
 Logs an error and returns a LogbackConfigurationException.
ResourceLoadException logAndInstantiateResourceLoad (String message, Throwable cause)
 Logs an error and creates a ResourceLoadException for any resource (audio, image, etc.).
UncheckedIOException logAndInstantiateUncheckedIO (String message, IOException cause)
 Logs an error and returns an UncheckedIOException.
UnsupportedOperationException logAndInstantiateUnsupportedOperation (String message)
 Logs an error and returns an UnsupportedOperationException without a cause.
UnsupportedOperationException logAndInstantiateUnsupportedOperation (String message, Throwable cause)
 Logs an error and returns an UnsupportedOperationException.
void logAndThrowIllegalArgumentIfBlank (String value, String message)
 Logs the given message and throws an IllegalArgumentException if the given string is null, empty, or blank (only whitespace).

Public Attributes

 INSTANCE

Static Public Attributes

static final String EXCEPTION = "Exception"

Static Private Attributes

static final Logger LOG = LoggerFactory.getLogger(ExceptionTools.class)

Detailed Description

Utility enum for handling and analyzing exceptions.

This enum provides methods to search for specific exception types within exception chains and centralizes error logging.

Member Function Documentation

◆ findSQLInvalidAuthException()

SQLInvalidAuthorizationSpecException fr.softsf.sudokufx.common.exception.ExceptionTools.findSQLInvalidAuthException ( Throwable e)

Searches recursively through the exception chain to find the first SQLInvalidAuthorizationSpecException, starting from the given Throwable.

Parameters
ethe Throwable to inspect (may be null)
Returns
the first SQLInvalidAuthorizationSpecException found, or null if not found

◆ logAndInstantiate()

private< T extends Throwable > T fr.softsf.sudokufx.common.exception.ExceptionTools.logAndInstantiate ( String message,
Throwable cause,
BiFunction< String, Throwable, T > factory,
String defaultMsg,
String logPrefix )

Internal generic helper to centralize logging logic and exception instantiation.

Parameters
<T>the type of the exception to instantiate
messagecustom context message; if null or blank, a default message is used
causeoriginal exception cause; may be null
factoryfunctional interface to create the exception (e.g., Exception::new)
defaultMsgdefault message if the provided one is blank
logPrefixspecific prefix for the log message
Returns
the instantiated exception

◆ logAndInstantiateFolderCreation() [1/2]

FolderCreationException fr.softsf.sudokufx.common.exception.ExceptionTools.logAndInstantiateFolderCreation ( String message)

Logs an error and creates a FolderCreationException without a cause.

Parameters
messagedescriptive message of the failure; if null or blank, a default message is used
Returns
a new FolderCreationException instance
Here is the call graph for this function:

◆ logAndInstantiateFolderCreation() [2/2]

FolderCreationException fr.softsf.sudokufx.common.exception.ExceptionTools.logAndInstantiateFolderCreation ( String message,
Throwable cause )

Logs an error and creates a FolderCreationException with an optional cause.

Parameters
messagedescriptive message of the failure; if null or blank, a default message is used
causethe underlying exception that triggered the failure; may be null
Returns
a new FolderCreationException instance
Here is the call graph for this function:

◆ logAndInstantiateIllegalArgument() [1/2]

IllegalArgumentException fr.softsf.sudokufx.common.exception.ExceptionTools.logAndInstantiateIllegalArgument ( String message)

Logs the given message and returns an instance of IllegalArgumentException with it.

Parameters
messagethe error message
Returns
the IllegalArgumentException instance (not thrown)
Here is the call graph for this function:

◆ logAndInstantiateIllegalArgument() [2/2]

IllegalArgumentException fr.softsf.sudokufx.common.exception.ExceptionTools.logAndInstantiateIllegalArgument ( String message,
Throwable cause )

Logs the message and cause, then returns an IllegalArgumentException.

Parameters
messagethe error message
causethe original exception that triggered the failure; may be null
Returns
the IllegalArgumentException instance (not thrown)
Here is the call graph for this function:

◆ logAndInstantiateIllegalState()

IllegalStateException fr.softsf.sudokufx.common.exception.ExceptionTools.logAndInstantiateIllegalState ( String message)

Logs an error and returns an IllegalStateException.

Parameters
messagedescriptive message
Returns
a new IllegalStateException instance
Here is the call graph for this function:

◆ logAndInstantiateLogbackConfig()

LogbackConfigurationException fr.softsf.sudokufx.common.exception.ExceptionTools.logAndInstantiateLogbackConfig ( String message,
Throwable cause )

Logs an error and returns a LogbackConfigurationException.

Parameters
messagedescriptive message of the failure; may be null or blank
causethe original exception that triggered the failure; may be null
Returns
a new LogbackConfigurationException instance
Here is the call graph for this function:

◆ logAndInstantiateResourceLoad()

ResourceLoadException fr.softsf.sudokufx.common.exception.ExceptionTools.logAndInstantiateResourceLoad ( String message,
Throwable cause )

Logs an error and creates a ResourceLoadException for any resource (audio, image, etc.).

Handles null or blank messages and a null cause safely.

Parameters
messagedescriptive message of the failure; may be null or blank
causethe original exception that triggered the failure; may be null
Returns
a new ResourceLoadException instance
Here is the call graph for this function:

◆ logAndInstantiateUncheckedIO()

UncheckedIOException fr.softsf.sudokufx.common.exception.ExceptionTools.logAndInstantiateUncheckedIO ( String message,
IOException cause )

Logs an error and returns an UncheckedIOException.

Parameters
messagedescriptive message
causethe original IOException
Returns
a new UncheckedIOException instance
Here is the call graph for this function:

◆ logAndInstantiateUnsupportedOperation() [1/2]

UnsupportedOperationException fr.softsf.sudokufx.common.exception.ExceptionTools.logAndInstantiateUnsupportedOperation ( String message)

Logs an error and returns an UnsupportedOperationException without a cause.

Parameters
messagedescriptive message
Returns
a new UnsupportedOperationException instance
Here is the call graph for this function:

◆ logAndInstantiateUnsupportedOperation() [2/2]

UnsupportedOperationException fr.softsf.sudokufx.common.exception.ExceptionTools.logAndInstantiateUnsupportedOperation ( String message,
Throwable cause )

Logs an error and returns an UnsupportedOperationException.

Parameters
messagedescriptive message
causethe original exception; may be null
Returns
a new UnsupportedOperationException instance
Here is the call graph for this function:

◆ logAndThrowIllegalArgumentIfBlank()

void fr.softsf.sudokufx.common.exception.ExceptionTools.logAndThrowIllegalArgumentIfBlank ( String value,
String message )

Logs the given message and throws an IllegalArgumentException if the given string is null, empty, or blank (only whitespace).

Parameters
valuethe string to check
messagethe error message
Exceptions
IllegalArgumentExceptionif the string is blank or null
Here is the call graph for this function:

Member Data Documentation

◆ EXCEPTION

final String fr.softsf.sudokufx.common.exception.ExceptionTools.EXCEPTION = "Exception"
static

◆ INSTANCE

fr.softsf.sudokufx.common.exception.ExceptionTools.INSTANCE

◆ LOG

final Logger fr.softsf.sudokufx.common.exception.ExceptionTools.LOG = LoggerFactory.getLogger(ExceptionTools.class)
staticprivate

The documentation for this enum was generated from the following file: