Skip to content

Commit e8de21b

Browse files
committed
fix: throw client exception in some bridges
1 parent a599f4b commit e8de21b

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

bridges/ImgsedBridge.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function collectData()
5959
$this->collectTaggeds();
6060
}
6161
} catch (HttpException $e) {
62-
throw new \Exception(sprintf('Unable to find user `%s`', $username));
62+
throwClientException(sprintf('Unable to find user `%s`', $username));
6363
}
6464
}
6565

bridges/TelegramBridge.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function collectData()
6161

6262
$messages = $dom->find('div.tgme_widget_message_wrap.js-widget_message_wrap');
6363
if (!$channelTitle && !$messages) {
64-
throw new \Exception('Unable to find channel. The channel is non-existing or non-public.');
64+
throwClientException('Unable to find channel. The channel is non-existing or non-public.');
6565
}
6666

6767
foreach (array_reverse($messages) as $message) {

bridges/TwitchBridge.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function collectData()
9393
$response = $this->apiRequest($query, $variables);
9494
$data = $response->data;
9595
if ($data->user === null) {
96-
throw new \Exception(sprintf('Unable to find channel `%s`', $channel));
96+
throwClientException(sprintf('Unable to find channel `%s`', $channel));
9797
}
9898

9999
$user = $data->user;

lib/TwitterClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ private function fetchUserInfoByScreenName(string $screenName)
290290
$response = Json::decode(getContents($url, $this->createHttpHeaders()), false);
291291
if (isset($response->errors)) {
292292
// Grab the first error message
293-
throw new \Exception(sprintf('From twitter api: "%s"', $response->errors[0]->message));
293+
throwClientException(sprintf('From twitter api: "%s"', $response->errors[0]->message));
294294
}
295295
$userInfo = $response->data->user;
296296
$this->data[$screenName] = $userInfo;
@@ -423,7 +423,7 @@ private function fetchListInfoBySlug($screenName, $listSlug)
423423
$response = Json::decode(getContents($url, $this->createHttpHeaders()), false);
424424
if (isset($response->errors)) {
425425
// Grab the first error message
426-
throw new \Exception(sprintf('From twitter api: "%s"', $response->errors[0]->message));
426+
throwClientException(sprintf('From twitter api: "%s"', $response->errors[0]->message));
427427
}
428428
$listInfo = $response->data->user_by_screen_name->list;
429429
$this->data[$screenName . '-' . $listSlug] = $listInfo;

0 commit comments

Comments
 (0)