diff options
author | Azul <azul@riseup.net> | 2016-09-29 13:18:38 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2016-09-29 13:18:38 +0200 |
commit | 997af2eea91263b1d6c07e02a98f02f81a320acf (patch) | |
tree | 5c9a4eee04374258dfcb7ff6e1ecdd27f4852228 | |
parent | 4cd842927a60e4e81915da22983f216ccd54d6a3 (diff) |
use stderr for errors
-rw-r--r-- | lib/nickserver/dispatcher.rb | 6 | ||||
-rw-r--r-- | lib/nickserver/reel_server.rb | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/nickserver/dispatcher.rb b/lib/nickserver/dispatcher.rb index f9801d1..26ad09e 100644 --- a/lib/nickserver/dispatcher.rb +++ b/lib/nickserver/dispatcher.rb @@ -40,8 +40,8 @@ module Nickserver def handle(request) handler_chain.handle request rescue RuntimeError => exc - puts "Error: #{exc}" - puts exc.backtrace + $stderr.puts "Error: #{exc}" + $stderr.puts exc.backtrace ErrorResponse.new(exc.to_s) end @@ -64,7 +64,7 @@ module Nickserver def proxy_error_response exc = handler_chain.rescued_exceptions.first if exc - puts " Error: #{exc}" + $stderr.puts " Error: #{exc}" Nickserver::Response.new 502, JSON.dump(error: exc.to_s) end diff --git a/lib/nickserver/reel_server.rb b/lib/nickserver/reel_server.rb index 9a7053b..79265ec 100644 --- a/lib/nickserver/reel_server.rb +++ b/lib/nickserver/reel_server.rb @@ -36,8 +36,8 @@ module Nickserver handler = handler_for(request) handler.respond_to params(request), request.headers rescue StandardError => e - puts e - puts e.backtrace.join "\n " + $stderr.puts e + $stderr.puts e.backtrace.join "\n " request.respond 500, "{}" end |