Source for file Exceptions.php
Documentation is available at Exceptions.php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
* Payment_PayPal_SOAP is a package to easily use PayPal's SOAP API from PHP
* This file contains various package-specific exception class definitions.
* Copyright (c) 2008-2012 silverorange
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* @package Payment_PayPal_SOAP
* @author Michael Gauthier <mike@silverorange.com>
* @copyright 2008-2012 silverorange
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://pear.php.net/package/Payment_PayPal_SOAP
require_once 'Payment/PayPal/SOAP/Error.php';
// {{{ interface Payment_PayPal_SOAP_Exception
* Base interface for exceptions thrown by the Payment_PayPal_SOAP package
* @package Payment_PayPal_SOAP
* @author Michael Gauthier <mike@silverorange.com>
* @copyright 2008-2012 silverorange
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://pear.php.net/package/Payment_PayPal_SOAP
// {{{ class Payment_PayPal_SOAP_InvalidModeException
* Exception thrown when an invalid mode is used in the client constructor
* @package Payment_PayPal_SOAP
* @author Michael Gauthier <mike@silverorange.com>
* @copyright 2008-2012 silverorange
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://pear.php.net/package/Payment_PayPal_SOAP
extends InvalidArgumentException
// {{{ protected properties
* The invalid mode that was used
* @see Payment_PayPal_SOAP_InvalidModeException::getMode()
* Creates a new invalid mode exception
* @param string $message the exception message.
* @param integer $code the exception code.
* @param string $mode the invalid mode that was used.
public function __construct($message, $code = 0 , $mode = '')
parent ::__construct ($message, $code);
* Gets the invalid mode that was used
* @return string the invalid mode that was used.
* @see PaymentPayPal_SOAP_InvalidModeException::$_mode
// {{{ class Payment_PayPal_SOAP_InvalidRequestNameException
* Exception thrown when an invalid request name is used in the
* {@link Payment_PayPal_SOAP_Client::call()} method
* @package Payment_PayPal_SOAP
* @author Michael Gauthier <mike@silverorange.com>
* @copyright 2008-2012 silverorange
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://pear.php.net/package/Payment_PayPal_SOAP
extends InvalidArgumentException
// {{{ protected properties
* The invalid request name that was used
* @see Payment_PayPal_SOAP_InvalidRequestNameException::getRequestName()
* Creates a new invalid request name exception
* @param string $message the exception message.
* @param integer $code the exception code.
* @param string $requestName the invalid request name that was used.
public function __construct($message, $code = 0 , $requestName = '')
parent ::__construct ($message, $code);
* Gets the invalid request name that was used
* @return string the invalid request name that was used.
* @see PaymentPayPal_SOAP_InvalidRequestNameException::$_requestName
// {{{ class Payment_PayPal_SOAP_MissingPropertyException
* Exception thrown when a required request property is missing in the
* arguments parameter of a {@link Payment_PayPal_SOAP::call()} method
* @package Payment_PayPal_SOAP
* @author Michael Gauthier <mike@silverorange.com>
* @copyright 2008-2012 silverorange
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://pear.php.net/package/Payment_PayPal_SOAP
extends InvalidArgumentException
// {{{ protected properties
* The name of the property that is missing
* @see Payment_PayPal_SOAP_MissingPropertyNameException::getPropertyName()
* Creates a new missing property exception
* @param string $message the exception message.
* @param integer $code the exception code.
* @param string $propertyName the name of the property that is missing.
public function __construct($message, $code = 0 , $propertyName = '')
parent ::__construct ($message, $code);
* Gets the name of the property that is missing
* @return string the name of the property that is missing.
* @see PaymentPayPal_SOAP_MissingPropertyNameException::$_propertyName
// {{{ class Payment_PayPal_SOAP_FaultException
* Exception thrown when a SOAP fault occurs
* @package Payment_PayPal_SOAP
* @author Michael Gauthier <mike@silverorange.com>
* @copyright 2008-2012 silverorange
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://pear.php.net/package/Payment_PayPal_SOAP
// {{{ protected properties
* The original SoapFault that caused this exception to be thrown
* @see Payment_PayPal_SOAP_FaultException::getSoapFault()
* The SOAP client that caused the exception
* @see Payment_PayPal_SOAP_FaultException::getSoapClient()
// {{{ public function __construct()
* Creates a new PayPal SOAP fault exception
* @param string $message the exception message.
* @param integer $code the exception code.
* @param SoapFault $soapFault the original SoapFault.
* @param SoapClient $soapClient the SOAP client that caused the fault.
public function __construct($message, $code, SoapFault $soapFault,
parent ::__construct ($message, $code);
* Gets the original SoapFault that caused this exception to be thrown
* @return SoapFault the original SoapFault that caused this exception to
* Gets the original SOAP client that caused the exception
* @return SoapClient the SOAP client that caused the exception.
// {{{ class Payment_PayPal_SOAP_ErrorException
* Exception thrown when the SOAP response contains one or more Error elements
* A detailed error message is present in the message field. Individual errors
* can be retrieved using the iterator interface. For example:
* foreach ($exception as $error) {
* echo $error->getMessage(), "\n";
* echo $error->getCode(), "\n";
* echo $error->getSeverity(), "\n";
* echo $error->getType(), "\n";
* The full response object may be retrieved using the
* {@link Payment_PayPal_SOAP_ErrorException::getResponse()} method.
* @package Payment_PayPal_SOAP
* @author Michael Gauthier <mike@silverorange.com>
* @copyright 2008-2012 silverorange
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://pear.php.net/package/Payment_PayPal_SOAP
* @see Payment_PayPal_SOAP_Error
// {{{ protected properties
* The errors aggregated by this exception
* @see Payment_PayPal_SOAP_ErrorException::addError()
* @see Payment_PayPal_SOAP_ErrorException::getIterator()
* @see Payment_PayPal_SOAP_ErrorException::getSeverity()
* The response object that contains the PayPal error(s)
* @see Payment_PayPal_SOAP_ErrorException::getResponse()
* Creates a new error exception
* @param string $message the exception message.
* @param integer $code the exception code.
* @param stdClass $response the response object that contains the PayPal
public function __construct($message, $code, $response)
parent ::__construct ($message, $code);
* Adds an error to this exception
* @param string|Payment_PayPal_SOAP_Error$message either an error object
* @param integer $code optional. The error
* code. If first argument
* @param integer $severity optional. The error
* @param integer $type optional. The error
* @return Payment_PayPal_SOAP_ErrorException the current object for fluent
public function addError($message, $code = null , $severity = null ,
* Gets whether or not this exception has an aggregated error of the
* if ($e->hasType(Payment_PayPal_SOAP_Error::TYPE_EXPIRED_TOKEN)) {
* echo 'Your token has expired!';
* @param integer $type the type for which to check.
* @return boolean true if this exception has an aggregated error of the
* specified type. Otherwise false.
foreach ($this->errors as $error) {
if ($error->getType () == $type) {
* Gets whether or not this exception has an aggregated error of the
* if ($e->hasSeverity(Payment_PayPal_SOAP::ERROR_ERROR)) {
* echo 'Uh oh! Something went terribly wrong!';
* @param integer $severity the severity for which to check.
* @return boolean true if this exception has an aggregated error of the
* specified severity. Otherwise false.
foreach ($this->errors as $error) {
if ($error->getSeverity () == $severity) {
* Gets the severity of the PayPal error
* Will be one of the following:
* - {@link Payment_PayPal_SOAP::ERROR_WARNING},
* - {@link Payment_PayPal_SOAP::ERROR_ERROR}, or
* - {@link Payment_PayPal_SOAP::ERROR_UNKNOWN}
* @param integer $index optional. The index of the error for which to get
* the severity. If not specified, the severity of
* the first error is returned.
* @return integer the severity level of the PayPal error.
if (isset ($this->errors[$index])) {
$severity = $this->errors[$index]->getSeverity ();
* Gets the response object containing the PayPal error
* Additional information about the error may be present here.
* @return stdClass the response object containing the PayPal error.
* Gets an iterator object for the errors of this exception
* Fulfills the IteratorAggregate interface.
* @return array an iterator object for the errors of this exception.
return new ArrayObject ($this->errors);
* Gets the number of errors aggregated by this exception
* Fulfills the Countable interface.
* @return integer the number of errors aggregated by this exception
// {{{ class Payment_PayPal_SOAP_ExpiredTokenException
* Deprecated exception that used to be thrown when a request was made with
* an expired checkout token
* This exception class is no longer used. See
* {@link Payment_PayPal_SOAP_ErrorException} and the
* {@link Payment_PayPal_SOAP_ErrorException::hasType()} method.
* @package Payment_PayPal_SOAP
* @author Michael Gauthier <mike@silverorange.com>
* @copyright 2008-2012 silverorange
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://pear.php.net/package/Payment_PayPal_SOAP
* @deprecated Use {@link Payment_PayPal_SOAP_ErrorException} and the
* {@link Payment_PayPal_SOAP_ErrorException::hasType()} method
Documentation generated on Tue, 25 Sep 2012 14:30:03 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.
|