Package org.hawaiiframework.exception
Class ApiException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.hawaiiframework.exception.HawaiiException
-
- org.hawaiiframework.exception.ApiException
-
- All Implemented Interfaces:
Serializable
public class ApiException extends HawaiiException
Exception with a predefined error code.- Since:
- 2.0.0
- Author:
- Paul Klos
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ApiException(ApiError apiError)
Construct an API error.protected
ApiException(ApiError apiError, String message)
Construct an API error with a custome message.protected
ApiException(ApiError apiError, Throwable orig)
Construct an API error from a Throwable.protected
ApiException(ApiError apiError, Throwable orig, String message)
Construct an API error from a Throwable with a custom message.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ApiError
getApiError()
Getter for the ApiError.String
getErrorCode()
Convenience method to retrieve the error code from the contained API error.String
getReason()
Convenience method to retrieve the reason from the contained API error.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
ApiException
protected ApiException(ApiError apiError)
Construct an API error.- Parameters:
apiError
- the error code.
-
ApiException
protected ApiException(ApiError apiError, String message)
Construct an API error with a custome message.- Parameters:
apiError
- the error code.
-
ApiException
protected ApiException(ApiError apiError, Throwable orig)
Construct an API error from a Throwable.- Parameters:
apiError
- the error codeorig
- the cause of the error
-
-
Method Detail
-
getApiError
public ApiError getApiError()
Getter for the ApiError.- Returns:
- the ApiError
-
getErrorCode
public String getErrorCode()
Convenience method to retrieve the error code from the contained API error.- Returns:
- the error code
-
getReason
public String getReason()
Convenience method to retrieve the reason from the contained API error.- Returns:
- the reason
-
-