class TwitterApiException in Media entity Twitter 8.2
Same name and namespace in other branches
- 8 src/Exception/TwitterApiException.php \Drupal\media_entity_twitter\Exception\TwitterApiException
Exception thrown when Twitter's API returns errors in a response.
Hierarchy
- class \Drupal\media_entity_twitter\Exception\TwitterApiException extends \Drupal\media_entity_twitter\Exception\Exception
Expanded class hierarchy of TwitterApiException
1 file declares its use of TwitterApiException
- TweetFetcher.php in src/
TweetFetcher.php
File
- src/
Exception/ TwitterApiException.php, line 8
Namespace
Drupal\media_entity_twitter\ExceptionView source
class TwitterApiException extends \Exception {
/**
* TwitterApiException constructor.
*
* @param array $errors
* The errors returned from Twitter's API. Each error contains 'message'
* and 'code' elements.
* @param int $code
* (optional) The general error code for the exception.
* @param \Exception|null $previous
* (optional) The previous exception.
*
* @see https://dev.twitter.com/overview/api/response-codes
*/
public function __construct(array $errors, $code = 0, \Exception $previous = NULL) {
$errors = array_map(function (array $error) {
return sprintf('[%d] %s', $error['code'], $error['message']);
}, $errors);
array_unshift($errors, 'Twitter API returned error(s):');
$errors = implode("\n", $errors);
parent::__construct($errors, $code, $previous);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TwitterApiException:: |
public | function | TwitterApiException constructor. |