From 103b9cc2e3f884e6b89097bfed85fdb27507e0ee Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Wed, 8 May 2024 14:05:24 +1200 Subject: [PATCH] Improve Console logging. --- bin/falcon | 2 +- lib/falcon/middleware/proxy.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/falcon b/bin/falcon index a9ddfa41..6acec042 100755 --- a/bin/falcon +++ b/bin/falcon @@ -27,6 +27,6 @@ begin rescue Interrupt # Ignore. rescue => error - Console.logger.error(Falcon::Command) {error} + Console.error(Falcon::Command, error) exit! 1 end diff --git a/lib/falcon/middleware/proxy.rb b/lib/falcon/middleware/proxy.rb index e9a09937..f1347a29 100644 --- a/lib/falcon/middleware/proxy.rb +++ b/lib/falcon/middleware/proxy.rb @@ -140,9 +140,9 @@ def call(request) else super end - rescue - Console.logger.error(self) {$!} - return Protocol::HTTP::Response[502, {'content-type' => 'text/plain'}, ["#{$!.inspect}: #{$!.backtrace.join("\n")}"]] + rescue => error + Console.error(self, error) + return Protocol::HTTP::Response[502, {'content-type' => 'text/plain'}, [error.class.name]] end end end