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