Services_GeoNames
[ class tree: Services_GeoNames ] [ index: Services_GeoNames ] [ all elements ]

Source for file Exception.php

Documentation is available at Exception.php

  1. <?php
  2.  
  3. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  4.  
  5. /**
  6.  * This file is part of the PEAR Services_GeoNames package.
  7.  *
  8.  * PHP version 5
  9.  *
  10.  * LICENSE: This source file is subject to the MIT license that is available
  11.  * through the world-wide-web at the following URI:
  12.  * http://opensource.org/licenses/mit-license.php
  13.  *
  14.  * @category  Services
  15.  * @package   Services_GeoNames
  16.  * @author    David Jean Louis <izi@php.net>
  17.  * @copyright 2008-2009 David Jean Louis
  18.  * @license   http://opensource.org/licenses/mit-license.php MIT License
  19.  * @version   CVS: $Id: Exception.php 274374 2009-01-23 14:21:59Z izi $
  20.  * @link      http://pear.php.net/package/Services_GeoNames
  21.  * @link      http://www.geonames.org/export/webservice-exception.html
  22.  * @since     File available since release 0.1.0
  23.  * @filesource
  24.  */
  25.  
  26. /**
  27.  * Include the PEAR_Exception class.
  28.  */
  29. require_once 'PEAR/Exception.php';
  30.  
  31. /**
  32.  * Base class for exceptions raised by the Services_GeoNames package.
  33.  *
  34.  * @category  Services
  35.  * @package   Services_GeoNames
  36.  * @author    David Jean Louis <izi@php.net>
  37.  * @copyright 2008-2009 David Jean Louis
  38.  * @license   http://opensource.org/licenses/mit-license.php MIT License
  39.  * @version   Release: 1.0.1
  40.  * @link      http://pear.php.net/package/Services_GeoNames
  41.  * @link      http://www.geonames.org/export/webservice-exception.html
  42.  * @since     Class available since release 0.1.0
  43.  */
  44. class Services_GeoNames_Exception extends PEAR_Exception
  45. {
  46. }
  47.  
  48. /**
  49.  * Class for HTTP exceptions raised by the Services_GeoNames package.
  50.  * This specific exception allows the user to retrieve the error response
  51.  * returned by the server, for example:
  52.  *
  53.  * <code>
  54.  * try {
  55.  *     $geonames = new Services_GeoNames();
  56.  *     $geonames->someMethod();
  57.  * } catch (Services_GeoNames_HTTPException $exc) {
  58.  *     // HTTP error...
  59.  *     $response = $exc->response;
  60.  * } catch (Services_GeoNames_Exception $exc) {
  61.  *     // API error handling ...
  62.  * }
  63.  * </code>
  64.  *
  65.  * @category  Services
  66.  * @package   Services_GeoNames
  67.  * @author    David Jean Louis <izi@php.net>
  68.  * @copyright 2008-2009 David Jean Louis
  69.  * @license   http://opensource.org/licenses/mit-license.php MIT License
  70.  * @version   Release: 1.0.1
  71.  * @link      http://pear.php.net/package/Services_GeoNames
  72.  * @link      http://www.geonames.org/export/webservice-exception.html
  73.  * @since     Class available since release 0.1.0
  74.  */
  75. {
  76.     // properties {{{
  77.  
  78.     /**
  79.      * HTTP_Request2_Response instance.
  80.      *
  81.      * @var HTTP_Request2_Response $response 
  82.      */
  83.     public $response;
  84.  
  85.     // }}}
  86.     // __construct() {{{
  87.  
  88.     /**
  89.      * Constructor.
  90.      *
  91.      * @param string                 $msg  The exception message
  92.      * @param int|Exception         $p2   Exception code or cause
  93.      * @param HTTP_Request2_Response $resp Optional request response
  94.      *
  95.      * @return void 
  96.      */
  97.     public function __construct($msg$p2 = null$resp = null)
  98.     {
  99.         parent::__construct($msg$p2);
  100.         $this->response = $resp;
  101.     }
  102.  
  103.     // }}}
  104. }

Documentation generated on Mon, 11 Mar 2019 15:39:14 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.