|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Wabel\Zoho\CRM\Exception; |
|
4
|
|
|
|
|
5
|
|
|
use Wabel\Zoho\CRM\Request\Response; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Zoho CRM Exception. |
|
9
|
|
|
* |
|
10
|
|
|
* Error thrown when using the API |
|
11
|
|
|
* |
|
12
|
|
|
* @version 1.0.0 |
|
13
|
|
|
*/ |
|
14
|
|
|
class ZohoCRMResponseException extends ZohoCRMException |
|
15
|
|
|
{ |
|
16
|
|
|
public static $errorMessages = array( |
|
17
|
|
|
'0000' => 'Unknown error', |
|
18
|
|
|
'4000' => 'Please use Authtoken, instead of API ticket and API key.', |
|
19
|
|
|
'4500' => 'Internal server error while processing this request.', |
|
20
|
|
|
'4501' => 'API Key is inactive.', |
|
21
|
|
|
'4502' => 'This module is not supported in your edition.', |
|
22
|
|
|
'4401' => 'Mandatory field missing.', |
|
23
|
|
|
'4600' => 'Incorrect API parameter or API parameter value. Also check the method name and/or spelling errors in the API url.', |
|
24
|
|
|
'4831' => 'Missing parameters error.', |
|
25
|
|
|
'4832' => 'Text value given for an Integer field.', |
|
26
|
|
|
'4834' => 'Invalid ticket. Also check if ticket has expired.', |
|
27
|
|
|
'4835' => 'XML parsing error.', |
|
28
|
|
|
'4890' => 'Wrong API Key.', |
|
29
|
|
|
'4487' => 'No permission to convert lead.', |
|
30
|
|
|
'4001' => 'No API permission.', |
|
31
|
|
|
'401' => 'No module permission.', |
|
32
|
|
|
'401.1' => 'No permission to create a record.', |
|
33
|
|
|
'401.2' => 'No permission to edit a record.', |
|
34
|
|
|
'401.3' => 'No permission to delete a record.', |
|
35
|
|
|
'4101' => 'Zoho CRM disabled.', |
|
36
|
|
|
'4102' => 'No CRM account.', |
|
37
|
|
|
'4103' => 'No record available with the specified record ID.', |
|
38
|
|
|
'4422' => 'No records available in the module.', |
|
39
|
|
|
'4420' => 'Wrong value for search parameter and/or search parameter value.', |
|
40
|
|
|
'4421' => 'Number of API calls exceeded.', |
|
41
|
|
|
'4423' => 'Exceeded record search limit.', |
|
42
|
|
|
'4807' => 'Exceeded file size limit.', |
|
43
|
|
|
'4424' => 'Invalid File Type.', |
|
44
|
|
|
'4809' => 'Exceeded storage space limit.', |
|
45
|
|
|
); |
|
46
|
|
|
|
|
47
|
|
|
public function __construct(Response $zohoResponse) |
|
48
|
|
|
{ |
|
49
|
|
|
$code = $zohoResponse->getCode(); |
|
50
|
|
|
$message = "Code {$code} ".(isset(self::$errorMessages[$code]) ? '['.self::$errorMessages[$code].']' : '').' '.$zohoResponse->getMessage(); |
|
51
|
|
|
|
|
52
|
|
|
parent::__construct($message, $code); |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|