diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-12-16 23:57:08 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-12-16 23:57:08 -0800 |
commit | 5dea67ecf3dd868e7b375312cdef2c4651b11437 (patch) | |
tree | 106856f38f3e4b8934af0a584345ea09644b4b5e /lib/rainbows/error.rb | |
parent | 52ad3f270e758e5bfdfe965cbecbd20d5048062f (diff) | |
download | rainbows-5dea67ecf3dd868e7b375312cdef2c4651b11437.tar.gz |
Diffstat (limited to 'lib/rainbows/error.rb')
-rw-r--r-- | lib/rainbows/error.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/rainbows/error.rb b/lib/rainbows/error.rb index 2d8cd94..1e25626 100644 --- a/lib/rainbows/error.rb +++ b/lib/rainbows/error.rb @@ -4,6 +4,15 @@ module Rainbows class Error class << self + # if we get any error, try to write something back to the client + # assuming we haven't closed the socket, but don't get hung up + # if the socket is already closed or broken. We'll always ensure + # the socket is closed at the end of this function + def write(io, e) + msg = Error.response(e) and io.write_nonblock(msg) + rescue + end + def app(e) G.server.logger.error "app error: #{e.inspect}" G.server.logger.error e.backtrace.join("\n") |