summaryrefslogtreecommitdiffstats
path: root/lib/SparkPost/APIResponseException.php
blob: a491b3c9c120904eaad50349b8471f83bd634ee5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php

namespace SparkPost;

class APIResponseException extends \Exception
{
    /**
     * @var string
     */
    protected $apiMessage;

    /**
     * @var int
     */
    protected $apiCode;

    /**
     * @var string
     */
    protected $apiDescription;

    /**
     * Construct the exception.
     */
    public function __construct($message = '', $code = 0, $apiMessage = '', $apiCode = 0, $apiDescription = '')
    {
        $this->apiMessage = $apiMessage;
        $this->apiCode = $apiCode;
        $this->apiDescription = $apiDescription;
        parent::__construct($message, $code);
    }

    /**
     * Gets the Exception message.
     *
     * @return string the Exception message as a string.
     */
    public function getAPIMessage()
    {
        return $this->apiMessage;
    }

    /**
     * Gets the API Exception code.
     *
     * @return int the exception code as integer.
     */
    public function getAPICode()
    {
        return $this->apiCode;
    }

    /**
     * Gets the Exception description.
     *
     * @return string the Exception description as a string.
     */
    public function getAPIDescription()
    {
        return $this->apiDescription;
    }
}