net.rimlib.blackberry.api.paymentsdk
Class PaymentException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by net.rimlib.blackberry.api.paymentsdk.PaymentException
All Implemented Interfaces:
java.io.Serializable, ResultCodes
Direct Known Subclasses:
AppWorldUpdateRequired, DigitalGoodNotFoundException, IllegalApplicationException, PaymentServerException, UserCancelException

public class PaymentException
extends java.lang.Exception
implements ResultCodes

Thrown when a generic failure occurs with one of the PaymentEngine methods. Since all other exceptions specified in the Payment Service API are subclasses of PaymentException, if you want to handle all exceptions the same way, you only need to catch PaymentException to do so. If you want to handle each exception uniquely, you can catch PaymentServerException, DigitalGoodNotFoundException, UserCancelException, and IllegalApplicationException separately.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface net.rimlib.blackberry.api.paymentsdk.ResultCodes
REASON_APP_WORLD_NOT_CORRECT_VERSION, REASON_ARGUMENTS_ERROR, REASON_CANCELED, REASON_GOOD_NOT_FOUND, REASON_ILLEGAL_APPLICATION, REASON_NONE, REASON_SERVER_ERROR, REASON_UNKNOWN
 
Constructor Summary
PaymentException(java.lang.String message)
          Creates an exception with the given detail message.
PaymentException(java.lang.String message, int failureReasonIn)
          Creates an exception with the given detail message.
PaymentException(java.lang.String message, Invocation invocation)
          Creates an exception with the given Invocation data.
 
Method Summary
 Invocation getFailureInvocation()
          Retrieves the response of the failed invocation
 int getFailureReason()
          Retrieves a constant representing the reason this result is unsuccessful, or REASON_NONE if this result is successful.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PaymentException

public PaymentException(java.lang.String message)
Creates an exception with the given detail message.

Parameters:
message - The detail message.

PaymentException

public PaymentException(java.lang.String message,
                        int failureReasonIn)
Creates an exception with the given detail message.

Parameters:
message - The detail message.
failureReasonIn - One of the REASON_* constants in this interface .

PaymentException

public PaymentException(java.lang.String message,
                        Invocation invocation)
Creates an exception with the given Invocation data.

Parameters:
message - The detail message.
invocation - The invocation that caused the exception.
Method Detail

getFailureReason

public int getFailureReason()
Retrieves a constant representing the reason this result is unsuccessful, or REASON_NONE if this result is successful.

Returns:
One of the REASON_* constants. If this result is successful, then REASON_NONE is returned.

getFailureInvocation

public Invocation getFailureInvocation()
Retrieves the response of the failed invocation

Returns:
response of the failed invocation