1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-13 20:14:10 +02:00

feat: introduce RateLimitException (#4199)

This commit is contained in:
Dag
2024-08-08 02:13:04 +02:00
committed by GitHub
parent 7073bb2f46
commit 9973f731df
6 changed files with 24 additions and 7 deletions

View File

@@ -121,8 +121,12 @@ class DisplayAction implements ActionInterface
$items = $feedItems;
}
$feed = $bridge->getFeed();
} catch (\Exception $e) {
// Probably an exception inside a bridge
} catch (\Throwable $e) {
if ($e instanceof RateLimitException) {
// These are internally generated by bridges
$this->logger->info(sprintf('RateLimitException in DisplayAction(%s): %s', $bridge->getShortName(), create_sane_exception_message($e)));
return new Response(render(__DIR__ . '/../templates/exception.html.php', ['e' => $e]), 429);
}
if ($e instanceof HttpException) {
// Reproduce (and log) these responses regardless of error output and report limit
if ($e->getCode() === 429) {