| @@ 122-124 (lines=3) @@ | ||
| 119 | throw new Exception\InvalidCredentialsException('Your API key "' . $this->apiKey . '" is not valid for ' . $this->getName(), null, $ex); |
|
| 120 | } |
|
| 121 | ||
| 122 | if (isset($content->flag) && $content->flag == 6) { |
|
| 123 | throw new Exception\LimitationExceededException('Exceeded the maximum number of request with API key "' . $this->apiKey . '" for ' . $this->getName(), null, $ex); |
|
| 124 | } |
|
| 125 | } |
|
| 126 | ||
| 127 | throw $ex; |
|
| @@ 126-128 (lines=3) @@ | ||
| 123 | /* |
|
| 124 | * Limit exceeded |
|
| 125 | */ |
|
| 126 | if (isset($content->message_code) && $content->message_code == 'usage_limit_exceeded') { |
|
| 127 | throw new Exception\LimitationExceededException('Exceeded the maximum number of request with API key "' . $this->apiKey . '" for ' . $this->getName()); |
|
| 128 | } |
|
| 129 | ||
| 130 | /* |
|
| 131 | * Error |
|
| @@ 137-139 (lines=3) @@ | ||
| 134 | throw new Exception\InvalidCredentialsException('Missing API key for ' . $this->getName()); |
|
| 135 | } |
|
| 136 | ||
| 137 | if (isset($content->message_code) && $content->message_code == 'user_key_invalid') { |
|
| 138 | throw new Exception\InvalidCredentialsException('Your API key "' . $this->apiKey . '" is not valid for ' . $this->getName()); |
|
| 139 | } |
|
| 140 | ||
| 141 | if (!isset($content->result) || $content->result !== 'success') { |
|
| 142 | throw new Exception\RequestException('Could not get valid response from "' . $request->getUri() . '". Response is "' . $response->getBody()->getContents() . '"'); |
|