mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-27 10:04:53 +02:00
Improve logging and error handling (#3059)
* refactor: logging and errror handling
This commit is contained in:
@@ -16,9 +16,9 @@ final class RssBridge
|
||||
} catch (\Throwable $e) {
|
||||
Logger::error('Exception in main', ['e' => $e]);
|
||||
http_response_code(500);
|
||||
print render('error.html.php', [
|
||||
'message' => create_sane_exception_message($e),
|
||||
'stacktrace' => create_sane_stacktrace($e),
|
||||
print render(__DIR__ . '/../templates/error.html.php', [
|
||||
'message' => create_sane_exception_message($e),
|
||||
'trace' => trace_from_exception($e),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,7 @@ final class RssBridge
|
||||
return false;
|
||||
}
|
||||
$text = sprintf('%s at %s line %s', $message, trim_path_prefix($file), $line);
|
||||
// Drop the current frame
|
||||
Logger::warning($text);
|
||||
if (Debug::isEnabled()) {
|
||||
print sprintf('<pre>%s</pre>', $text);
|
||||
|
Reference in New Issue
Block a user