1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-28 10:30:12 +02:00

feat: embed response in http exception (#3847)

This commit is contained in:
Dag
2023-12-20 03:16:25 +01:00
committed by GitHub
parent 0c6ffbf5a4
commit 98a94855dc
5 changed files with 59 additions and 16 deletions

View File

@@ -33,7 +33,15 @@ class GettrBridge extends BridgeAbstract
$user,
min($this->getInput('limit'), 20)
);
$data = json_decode(getContents($api), false);
try {
$json = getContents($api);
} catch (HttpException $e) {
if ($e->getCode() === 400 && str_contains($e->response->getBody(), 'E_USER_NOTFOUND')) {
throw new \Exception('User not found: ' . $user);
}
throw $e;
}
$data = json_decode($json, false);
foreach ($data->result->aux->post as $post) {
$this->items[] = [