Package com.tapkey.mobile.error
Class TkException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.tapkey.mobile.error.TkException
-
- All Implemented Interfaces:
Serializable
public class TkException extends RuntimeException
TkException is used to represent exceptions inside many of the SDK's components. To retrieve more information about the type of exception, the result ofgetErrorCode()
must be inspected.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TkException()
Creates an empty TkException.TkException(TkErrorDescriptor tkErrorDescriptor)
Creates a new TkException with the given error descriptor.TkException(String errorCode)
Creates a TkException with the given error code.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getErrorCode()
Returns the exception's error code.String
getMessage()
Returns the exception's error message.TkErrorDescriptor
getTkErrorDescriptor()
Returns the exception's inner error descriptor.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
TkException
public TkException()
Creates an empty TkException.
-
TkException
public TkException(String errorCode)
Creates a TkException with the given error code.- Parameters:
errorCode
- the error code of the TkException. Note that this constructor will create aTkErrorDescriptor
with this error code internally.
-
TkException
public TkException(TkErrorDescriptor tkErrorDescriptor)
Creates a new TkException with the given error descriptor.- Parameters:
tkErrorDescriptor
- the TkErrorDescriptor to be set for the TkException.
-
-
Method Detail
-
getMessage
public String getMessage()
Returns the exception's error message. This method callsTkErrorDescriptor.getErrorMessage()
on the inner error descriptor.- Overrides:
getMessage
in classThrowable
- Returns:
- the error message.
-
getTkErrorDescriptor
public TkErrorDescriptor getTkErrorDescriptor()
Returns the exception's inner error descriptor. The error descriptor contains the exception's actual properties, such as error message, error code and additional error data.- Returns:
- the exception's error descriptor.
-
getErrorCode
public String getErrorCode()
Returns the exception's error code. This method callsTkErrorDescriptor.getErrorCode()
on the inner error descriptor.- Returns:
- the error code.
-
-