ccb250b42fd25efafec2858c7822d19c540cdbcc
[yaffs-website] / vendor / php-instagram-api / php-instagram-api / Instagram / Core / ApiException.php
1 <?php
2
3 /**
4 * Instagram PHP
5 * @author Galen Grover <galenjr@gmail.com>
6 * @license http://opensource.org/licenses/mit-license.php The MIT License
7 */
8
9 namespace Instagram\Core;
10
11 /**
12  * API Exception
13  *
14  * This exception type will be thrown for any API error
15  *
16  * {@link https://github.com/galen/PHP-Instagram-API/blob/master/Examples/index.php#L48}
17  */
18 class ApiException extends \Exception {
19
20     /**
21      * Invalid APU URI
22      */
23     const TYPE_NOT_ALLOWED  = 'APINotAllowedError';
24
25     /**
26      * Authorization error
27      */
28     const TYPE_OAUTH        = 'OAuthAccessTokenException';
29
30     /**
31      * Type of error
32      * 
33      * @var string
34      */
35     protected $type;
36
37     /**
38      * Constructor
39      * 
40      * @param string  $message Error message
41      * @param integer $code Error code
42      * @param string  $type Error type
43      * @param Exception $previous Previous exception
44      */
45     public function __construct( $message = null, $code = 0, $type = null, \Exception $previous = null ) {
46         $this->type = $type;
47         parent::__construct( $message, $code, $previous );
48     }
49
50     /**
51      * Get error type
52      * 
53      * @return string Get teh error type
54      */
55     public function getType() {
56         return $this->type;
57     }
58
59 }