Skip to content

Commit

Permalink
improve error response
Browse files Browse the repository at this point in the history
  • Loading branch information
kringkaste committed Feb 16, 2021
1 parent 3a8c15d commit ed2de67
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Instagram Feed Changelog

## Unreleased
## 1.0.6 - 2021-02-16
### Added
- Enable environment variables for setting username (thanks to @niektenhoopen)
- Add rel noopener and noreferrer properties to links (thanks to @JayBox325)
- Add full image URL
- Add hasAudio attribute
- Add rel noopener and noreferrer properties to links in the README (thanks to @JayBox325)
- Add full image URL attribute.
- Add hasAudio attribute.

### Changed
- Prevent request storm if no items are cached and the request failed.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "codemonauts/craft-instagram-feed",
"description": "Craft CMS plugin to receive Instragram feed data as variable in templates.",
"version": "1.0.5",
"version": "1.0.6",
"type": "craft-plugin",
"keywords": [
"craft",
Expand Down
12 changes: 10 additions & 2 deletions src/services/InstagramService.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ private function getInstagramAccountData(string $account): array
}

if (!array_key_exists('ProfilePage', $obj['entry_data'])) {
Craft::error('Instagram profile data could not be fetched. Maybe the site structure has changed.', __METHOD__);
if (stripos($html, 'welcome back to instagram') !== false) {
Craft::error('Instagram tag data could not be fetched. It seems that your IP address has been blocked by Instagram. See https://github.com/codemonauts/craft-instagram-feed/issues/32', __METHOD__);
} else {
Craft::error('Instagram tag data could not be fetched. Maybe the site structure has changed.', __METHOD__);
}

return [];
}
Expand Down Expand Up @@ -136,7 +140,11 @@ private function getInstagramTagData(string $tag): array
}

if (!array_key_exists('TagPage', $obj['entry_data'])) {
Craft::error('Instagram tag data could not be fetched. Maybe the site structure has changed.', __METHOD__);
if (stripos($html, 'welcome back to instagram') !== false) {
Craft::error('Instagram tag data could not be fetched. It seems that your IP address has been blocked by Instagram. See https://github.com/codemonauts/craft-instagram-feed/issues/32', __METHOD__);
} else {
Craft::error('Instagram tag data could not be fetched. Maybe the site structure has changed.', __METHOD__);
}

return [];
}
Expand Down

0 comments on commit ed2de67

Please sign in to comment.