1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-18 14:22:38 +02:00

fix: throw client exception in some bridges (#4661)

This commit is contained in:
Dag
2025-08-08 02:24:13 +02:00
committed by GitHub
parent a599f4ba83
commit 37174f01e5
4 changed files with 5 additions and 5 deletions

View File

@@ -59,7 +59,7 @@ class ImgsedBridge extends BridgeAbstract
$this->collectTaggeds(); $this->collectTaggeds();
} }
} catch (HttpException $e) { } catch (HttpException $e) {
throw new \Exception(sprintf('Unable to find user `%s`', $username)); throwClientException(sprintf('Unable to find user `%s`', $username));
} }
} }

View File

@@ -61,7 +61,7 @@ class TelegramBridge extends BridgeAbstract
$messages = $dom->find('div.tgme_widget_message_wrap.js-widget_message_wrap'); $messages = $dom->find('div.tgme_widget_message_wrap.js-widget_message_wrap');
if (!$channelTitle && !$messages) { if (!$channelTitle && !$messages) {
throw new \Exception('Unable to find channel. The channel is non-existing or non-public.'); throwClientException('Unable to find channel. The channel is non-existing or non-public.');
} }
foreach (array_reverse($messages) as $message) { foreach (array_reverse($messages) as $message) {

View File

@@ -93,7 +93,7 @@ EOD;
$response = $this->apiRequest($query, $variables); $response = $this->apiRequest($query, $variables);
$data = $response->data; $data = $response->data;
if ($data->user === null) { if ($data->user === null) {
throw new \Exception(sprintf('Unable to find channel `%s`', $channel)); throwClientException(sprintf('Unable to find channel `%s`', $channel));
} }
$user = $data->user; $user = $data->user;

View File

@@ -290,7 +290,7 @@ class TwitterClient
$response = Json::decode(getContents($url, $this->createHttpHeaders()), false); $response = Json::decode(getContents($url, $this->createHttpHeaders()), false);
if (isset($response->errors)) { if (isset($response->errors)) {
// Grab the first error message // Grab the first error message
throw new \Exception(sprintf('From twitter api: "%s"', $response->errors[0]->message)); throwClientException(sprintf('From twitter api: "%s"', $response->errors[0]->message));
} }
$userInfo = $response->data->user; $userInfo = $response->data->user;
$this->data[$screenName] = $userInfo; $this->data[$screenName] = $userInfo;
@@ -423,7 +423,7 @@ class TwitterClient
$response = Json::decode(getContents($url, $this->createHttpHeaders()), false); $response = Json::decode(getContents($url, $this->createHttpHeaders()), false);
if (isset($response->errors)) { if (isset($response->errors)) {
// Grab the first error message // Grab the first error message
throw new \Exception(sprintf('From twitter api: "%s"', $response->errors[0]->message)); throwClientException(sprintf('From twitter api: "%s"', $response->errors[0]->message));
} }
$listInfo = $response->data->user_by_screen_name->list; $listInfo = $response->data->user_by_screen_name->list;
$this->data[$screenName . '-' . $listSlug] = $listInfo; $this->data[$screenName . '-' . $listSlug] = $listInfo;