| 1 | <?php |
||
| 20 | class Error |
||
| 21 | { |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var string $message |
||
| 25 | * |
||
| 26 | * @JMS\XmlElement() |
||
| 27 | * @JMS\Type("string") |
||
| 28 | * @JMS\SerializedName("message") |
||
| 29 | */ |
||
| 30 | protected $message; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @var int $code |
||
| 34 | * |
||
| 35 | * @JMS\XmlElement() |
||
| 36 | * @JMS\Type("integer") |
||
| 37 | * @JMS\SerializedName("code") |
||
| 38 | */ |
||
| 39 | protected $code; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Map of APIs error codes to exceptions |
||
| 43 | * |
||
| 44 | * @var array $exceptionMap |
||
| 45 | * |
||
| 46 | * @JMS\Exclude() |
||
| 47 | */ |
||
| 48 | private $exceptionMap = [ |
||
| 49 | 1001 => NoSuchMethodException::class, |
||
| 50 | 1002 => NoSuchDataProviderException::class, |
||
| 51 | 1003 => NoInputParametersSpecifiedException::class, |
||
| 52 | ]; |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Get the corresponding exception mapped to APIs error code |
||
| 56 | * |
||
| 57 | * @return NotFoundException |
||
| 58 | */ |
||
| 59 | public function getException() |
||
| 69 | |||
| 70 | } |
||
| 71 |