mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-01 14:24:39 +03:00
fix: produce smaller log records for http exceptions (#3153)
This commit is contained in:
parent
4ac2feb392
commit
88766e6fde
2 changed files with 9 additions and 2 deletions
|
@ -152,7 +152,14 @@ class DisplayAction implements ActionInterface
|
||||||
'icon' => $bridge->getIcon()
|
'icon' => $bridge->getIcon()
|
||||||
];
|
];
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
Logger::error(sprintf('Exception in %s', $bridgeClassName), ['e' => $e]);
|
if ($e instanceof HttpException) {
|
||||||
|
// Produce a smaller log record for http exceptions
|
||||||
|
Logger::warning(sprintf('Exception in %s: %s', $bridgeClassName, create_sane_exception_message($e)));
|
||||||
|
} else {
|
||||||
|
// Log the exception
|
||||||
|
Logger::error(sprintf('Exception in %s', $bridgeClassName), ['e' => $e]);
|
||||||
|
}
|
||||||
|
|
||||||
$errorCount = logBridgeError($bridge::NAME, $e->getCode());
|
$errorCount = logBridgeError($bridge::NAME, $e->getCode());
|
||||||
|
|
||||||
if ($errorCount >= Configuration::getConfig('error', 'report_limit')) {
|
if ($errorCount >= Configuration::getConfig('error', 'report_limit')) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ function get_current_url(): string
|
||||||
function create_sane_exception_message(\Throwable $e): string
|
function create_sane_exception_message(\Throwable $e): string
|
||||||
{
|
{
|
||||||
return sprintf(
|
return sprintf(
|
||||||
'Exception %s: %s in %s line %s',
|
'%s: %s in %s line %s',
|
||||||
get_class($e),
|
get_class($e),
|
||||||
$e->getMessage(),
|
$e->getMessage(),
|
||||||
trim_path_prefix($e->getFile()),
|
trim_path_prefix($e->getFile()),
|
||||||
|
|
Loading…
Add table
Reference in a new issue