Skip to content

Commit

Permalink
Merge pull request #592 from retrowaver/fix_exception_types
Browse files Browse the repository at this point in the history
fix types of exceptions
  • Loading branch information
raiym authored Feb 10, 2020
2 parents 0b212b1 + 2cee012 commit 631c932
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/InstagramScraper/Instagram.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ public function getAccount($username)
$userArray = self::extractSharedDataFromBody($response->raw_body);

if (!isset($userArray['entry_data']['ProfilePage'][0]['graphql']['user'])) {
throw new InstagramNotFoundException('Account with this username does not exist');
throw new InstagramException('Response code is ' . $response->code . '. Body: ' . static::getErrorBody($response->body) . ' Something went wrong. Please report issue.', $response->code);
}
return Account::create($userArray['entry_data']['ProfilePage'][0]['graphql']['user']);
}
Expand Down Expand Up @@ -489,7 +489,7 @@ public function getMediasFromFeed($username, $count = 20)
$userArray = $this->decodeRawBodyToJson($response->raw_body);

if (!isset($userArray['graphql']['user'])) {
throw new InstagramNotFoundException('Account with this username does not exist');
throw new InstagramException('Response code is ' . $response->code . '. Body: ' . static::getErrorBody($response->body) . ' Something went wrong. Please report issue.', $response->code);
}

$nodes = $userArray['graphql']['user']['edge_owner_to_timeline_media']['edges'];
Expand Down

0 comments on commit 631c932

Please sign in to comment.