Package io.mosip.kernel.core.exception
Class BaseCheckedException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- io.mosip.kernel.core.exception.BaseCheckedException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BiometricException,HashUtilException,IdObjectIOException,IdObjectValidationFailedException,InvalidApplicantArgumentException,InvalidIdSchemaException,IOException,JsonGenerationException,JsonMappingException,JsonParseException,JsonProcessingException,QrcodeGenerationException
public class BaseCheckedException extends Exception
This is the base class for all MOSIP checked exceptions. The class and its subclasses are a form that indicates conditions that a reasonable application might want to catch.The class
BaseCheckedExceptionand any subclasses that are not also subclasses ofBaseUncheckedExceptionare checked exceptions. Checked exceptions need to be declared in a method or constructor'sthrowsclause if they can be thrown by the execution of the method or constructor and propagate outside the method or constructor boundary.- Since:
- 1.0
- Author:
- Shashank Agrawal
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BaseCheckedException()Constructs a new checked exceptionBaseCheckedException(String errorMessage)Constructs a new checked exception with errorMessageBaseCheckedException(String errorCode, String errorMessage)Constructs a new checked exception with the specified detail message and error code.BaseCheckedException(String errorCode, String errorMessage, Throwable rootCause)Constructs a new checked exception with the specified detail message and error code and specified cause.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BaseCheckedExceptionaddInfo(String errorCode, String errorText)This method add error code and error message.List<String>getCodes()Returns the list of exception codes.StringgetErrorCode()Return the last error code.StringgetErrorText()Return the last exception message.List<String>getErrorTexts()Returns the list of exception messages.StringgetMessage()-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
BaseCheckedException
public BaseCheckedException()
Constructs a new checked exception
-
BaseCheckedException
public BaseCheckedException(String errorMessage)
Constructs a new checked exception with errorMessage- Parameters:
errorMessage- the detail message.
-
BaseCheckedException
public BaseCheckedException(String errorCode, String errorMessage)
Constructs a new checked exception with the specified detail message and error code.- Parameters:
errorCode- the error codeerrorMessage- the detail message.
-
BaseCheckedException
public BaseCheckedException(String errorCode, String errorMessage, Throwable rootCause)
Constructs a new checked exception with the specified detail message and error code and specified cause.- Parameters:
errorCode- the error codeerrorMessage- the detail message.rootCause- the specified cause
-
-
Method Detail
-
addInfo
public BaseCheckedException addInfo(String errorCode, String errorText)
This method add error code and error message.- Parameters:
errorCode- the error codeerrorText- the detail message.- Returns:
- the current instance of BaseCheckedException
-
getMessage
public String getMessage()
- Overrides:
getMessagein classThrowable
-
getCodes
public List<String> getCodes()
Returns the list of exception codes.- Returns:
- list of exception codes
-
getErrorTexts
public List<String> getErrorTexts()
Returns the list of exception messages.- Returns:
- list of exception messages
-
getErrorCode
public String getErrorCode()
Return the last error code.- Returns:
- the last error code
-
getErrorText
public String getErrorText()
Return the last exception message.- Returns:
- the last exception message
-
-