public function TwitterApiException::__construct in Media entity Twitter 8
Same name and namespace in other branches
- 8.2 src/Exception/TwitterApiException.php \Drupal\media_entity_twitter\Exception\TwitterApiException::__construct()
TwitterApiException constructor.
Parameters
array $errors: The errors returned from Twitter's API. Each error contains 'message' and 'code' elements.
int $code: (optional) The general error code for the exception.
\Exception|NULL $previous: (optional) The previous exception.
See also
https://dev.twitter.com/overview/api/response-codes
File
- src/
Exception/ TwitterApiException.php, line 23
Class
- TwitterApiException
- Exception thrown when Twitter's API returns errors in a response.
Namespace
Drupal\media_entity_twitter\ExceptionCode
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);
}