mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-22 19:38:38 +00:00
fix: dont log user errors (#4660)
This commit is contained in:
parent
81ce9c9483
commit
a599f4ba83
@ -89,12 +89,12 @@ class DisplayAction implements ActionInterface
|
||||
$bridge->collectData();
|
||||
$items = $bridge->getItems();
|
||||
} 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)));
|
||||
if ($e instanceof ClientException) {
|
||||
$this->logger->debug(sprintf('Exception in DisplayAction(%s): %s', $bridge->getShortName(), create_sane_exception_message($e)));
|
||||
} elseif ($e instanceof RateLimitException) {
|
||||
$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]), 429);
|
||||
}
|
||||
if ($e instanceof HttpException) {
|
||||
} elseif ($e instanceof HttpException) {
|
||||
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)));
|
||||
@ -102,7 +102,6 @@ class DisplayAction implements ActionInterface
|
||||
}
|
||||
// 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]);
|
||||
}
|
||||
$errorOutput = Configuration::getConfig('error', 'output');
|
||||
|
@ -242,9 +242,16 @@ function create_random_string(int $bytes = 16): string
|
||||
return bin2hex(openssl_random_pseudo_bytes($bytes));
|
||||
}
|
||||
|
||||
/**
|
||||
* Thrown by bridges to indicate user failure. Will not be logged.
|
||||
*/
|
||||
final class ClientException extends \Exception
|
||||
{
|
||||
}
|
||||
|
||||
function throwClientException(string $message = '')
|
||||
{
|
||||
throw new \Exception($message, 400);
|
||||
throw new ClientException($message, 400);
|
||||
}
|
||||
|
||||
function throwServerException(string $message = '')
|
||||
|
Loading…
Reference in New Issue
Block a user