java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.refcodes.exception.AbstractHiddenException
- All Implemented Interfaces:
Serializable
,ErrorCodeAccessor
,Trap
- Direct Known Subclasses:
HiddenException
public abstract class AbstractHiddenException extends RuntimeException implements Trap
Base exception for hidden (unchecked) / subsystem exceptions, providing
functionality for exception specific multi-language messages. A hidden
exception is an exception not representing the behavior of a system by its
declared checked and runtime exceptions. Moreover, hidden exceptions may
originate from subsystems wrapped by a system without the wrapping system
being able to declare the actual subsystem's cause in its declarations (due
to e.g. interface compliance reasons). You as a programmer cannot take care
to prevent such exception as them may be even undocumented. Such exceptions
may be exceptions wrapping an actual cause. Requiring a hidden exceptions may
point to problems of your software design, the use of hidden exceptrions
should be avoided.
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.exception.ErrorCodeAccessor
ErrorCodeAccessor.ErrorCodeBuilder<B extends ErrorCodeAccessor.ErrorCodeBuilder<B>>, ErrorCodeAccessor.ErrorCodeMutator, ErrorCodeAccessor.ErrorCodeProperty
-
Constructor Summary
Constructors Constructor Description AbstractHiddenException(String message, Throwable cause)
Instantiates a new abstract hidden exception.AbstractHiddenException(String aMessage, Throwable aCause, String aErrorCode)
AbstractHiddenException(Throwable cause)
Instantiates a new abstract hidden exception.AbstractHiddenException(Throwable aCause, String aErrorCode)
-
Method Summary
Modifier and Type Method Description String
getErrorCode()
Provides the according exception code.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
AbstractHiddenException
Instantiates a new abstract hidden exception.- Parameters:
message
- the messagecause
- the cause
-
AbstractHiddenException
Instantiates a new abstract hidden exception.- Parameters:
cause
- the cause
-
AbstractHiddenException
- Parameters:
aMessage
- - the detail message (which is saved for later retrieval by the Throwable.getMessage() method).aCause
- - the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)aErrorCode
- The exception code to be assigned to the exception. An exception code can be provided when creating an exception and it can be used by the business logic to retrieve a language depended exception message (multi-language support) from a language pack instead of just providing the single language message as being stored by the default exceptions.
-
AbstractHiddenException
- Parameters:
aCause
- - the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)aErrorCode
- The exception code to be assigned to the exception. An exception code can be provided when creating an exception and it can be used by the business logic to retrieve a language depended exception message (multi-language support) from a language pack instead of just providing the single language message as being stored by the default exceptions.
-
-
Method Details
-
getErrorCode
Provides the according exception code. An exception code can be provided when creating an exception and it can be used by the business logic to retrieve a language depended exception message (multi-language support) from a language pack instead of just providing the single language message as being stored by the default exceptions.- Specified by:
getErrorCode
in interfaceErrorCodeAccessor
- Returns:
- The exception code in question.
-