aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Dag <me@dvikan.no> 2024-08-30 00:22:11 +0200
committerGravatar GitHub <noreply@github.com> 2024-08-30 00:22:11 +0200
commit9f48370eb0fd5aba832b9db9eb9b1bc8915f5417 (patch)
tree9edec1d5ff740056b93f5ab51a318b3d41c10afd
parent39952c2d95cf4806063abbc2c7508cf9ab4f93e5 (diff)
downloadrss-bridge-9f48370eb0fd5aba832b9db9eb9b1bc8915f5417.tar.gz
rss-bridge-9f48370eb0fd5aba832b9db9eb9b1bc8915f5417.tar.zst
rss-bridge-9f48370eb0fd5aba832b9db9eb9b1bc8915f5417.zip
fix: tweak caching logic (#4241)
-rw-r--r--actions/DisplayAction.php17
1 files changed, 8 insertions, 9 deletions
diff --git a/actions/DisplayAction.php b/actions/DisplayAction.php
index c00c0d5e..9749004f 100644
--- a/actions/DisplayAction.php
+++ b/actions/DisplayAction.php
@@ -125,17 +125,16 @@ class DisplayAction implements ActionInterface
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) {
- $this->logger->info(sprintf('Exception 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->getCode() === 503) {
- $this->logger->info(sprintf('Exception in DisplayAction(%s): %s', $bridge->getShortName(), create_sane_exception_message($e)));
- return new Response(render(__DIR__ . '/../templates/exception.html.php', ['e' => $e]), 503);
+ if (in_array($e->getCode(), [429, 503])) {
+ // Log with debug, immediately reproduce and return
+ $this->logger->debug(sprintf('Exception in DisplayAction(%s): %s', $bridge->getShortName(), create_sane_exception_message($e)));
+ return new Response(render(__DIR__ . '/../templates/exception.html.php', ['e' => $e]), $e->getCode());
}
+ // Some other status code which we let fail normally (but don't log it)
+ } else {
+ // Log error if it's not an HttpException
+ $this->logger->error(sprintf('Exception in DisplayAction(%s)', $bridge->getShortName()), ['e' => $e]);
}
- $this->logger->error(sprintf('Exception in DisplayAction(%s)', $bridge->getShortName()), ['e' => $e]);
$errorOutput = Configuration::getConfig('error', 'output');
$reportLimit = Configuration::getConfig('error', 'report_limit');
$errorCount = 1;