Skip to content
Snippets Groups Projects
Commit e4ee841e authored by Primoz Hmeljak's avatar Primoz Hmeljak Committed by Primoz Hmeljak
Browse files

Issue #3303102 by Primsi: Undefined array key "X-Ratelimit-Limit" error

parent 3c5cbfbb
Branches
Tags 1.0.0-alpha3
No related merge requests found
......@@ -410,10 +410,15 @@ class PexelsWidget extends WidgetBase {
$results = $this->pexelsClient
->setApiKey($this->configuration['api_key'])
->search($input['keyword'], $this->defaultPerPage, $page, $input['orientation'] ?: '', $input['color'] ?: '');
if (!isset($results['contents'])) {
throw new \Exception('Result contents were empty.');
}
$search_results = $results['contents'];
}
catch (\Exception $e) {
$this->messenger()->addError('There was an error while fetching the results. Please contact the system administrator.');
$this->messenger()->addError($this->t('There was an error while fetching the results. Please contact the system administrator.'));
$this->loggerFactory->get('media_pexels')->error($e->getMessage());
return $form;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment