Skip to content

Commit

Permalink
fix types of exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
retrowaver committed Jan 27, 2020
1 parent 924cc5e commit 2cee012
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 2cee012

Please sign in to comment.