diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-11-26 14:09:45 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-11-26 14:19:04 -0800 |
commit | 5868eeecb2fbc85f3e4fabf3d16f27d259491c0d (patch) | |
tree | 21746be61158f9c177bc8e2600d7922cdedc7ce1 /lib/rainbows/ev_core.rb | |
parent | 278d9d5a7f3d2dc3c6563af1584b5e773e08073d (diff) | |
download | rainbows-5868eeecb2fbc85f3e4fabf3d16f27d259491c0d.tar.gz |
Make sure app errors get logged correctly, and we no longer return a 500 response when a client EOFs the write end (but not the read end) of a connection.
Diffstat (limited to 'lib/rainbows/ev_core.rb')
-rw-r--r-- | lib/rainbows/ev_core.rb | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/lib/rainbows/ev_core.rb b/lib/rainbows/ev_core.rb index e0fb029..f61b33f 100644 --- a/lib/rainbows/ev_core.rb +++ b/lib/rainbows/ev_core.rb @@ -26,17 +26,7 @@ module Rainbows end def handle_error(e) - msg = case e - when EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL,Errno::EBADF - ERROR_500_RESPONSE - when HttpParserError # try to tell the client they're bad - ERROR_400_RESPONSE - else - G.server.logger.error "Read error: #{e.inspect}" - G.server.logger.error e.backtrace.join("\n") - ERROR_500_RESPONSE - end - write(msg) + msg = Error.response(e) and write(msg) ensure quit end @@ -79,7 +69,7 @@ module Rainbows @input.close if File === @input end end - rescue Object => e + rescue => e handle_error(e) end |