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