MpesaSdkException
A generic exception thrown by the M-Pesa SDK for Java. This exception is used to indicate unexpected errors that occur while interacting with the M-Pesa API. These errors may arise due to network issues, configuration problems, or internal SDK errors.
Fields
- exception: The original exception that caused this error.
- mpesaError: The M-Pesa API error response.
Constructors
-
MpesaSdkException(String message)
Creates an instance ofMpesaSdkExceptionwith the specified error message.- Parameters:
message: The error message describing the issue.
- Parameters:
-
MpesaSdkException(String message, Exception exception)
Creates an instance ofMpesaSdkExceptionwith the specified error message and the original exception.- Parameters:
message: The error message describing the issue.exception: The original exception that caused this error.
- Parameters:
DataValidationException
An exception thrown by the SDK when an error occurs during user input validation. This exception wraps a message that describes the validation error(s).
Constructors
- DataValidationException(String message)
Creates an instance ofDataValidationExceptionwith the specified error message.- Parameters:
message: The message describing the validation error(s).
- Parameters:
MpesaApiException
An exception thrown by the SDK when an error occurs while calling the M-Pesa API. This exception wraps the MpesaError object, which contains the error code and message returned by the API.
Fields
- mpesaError: The
MpesaErrorobject containing the error code and message returned by the M-Pesa API.
Constructors
- MpesaApiException(String message, MpesaError mpesaError)
Creates an instance ofMpesaApiExceptionwith the specified error message and theMpesaErrorobject.- Parameters:
message: The error message describing the issue.mpesaError: TheMpesaErrorobject containing the error details from the M-Pesa API.
- Parameters: