1 # -*- encoding: binary -*-
7 # if we get any error, try to write something back to the client
8 # assuming we haven't closed the socket, but don't get hung up
9 # if the socket is already closed or broken. We'll always ensure
10 # the socket is closed at the end of this function
12 msg = Error.response(e) and io.write_nonblock(msg)
17 G.server.logger.error "app error: #{e.inspect}"
18 G.server.logger.error e.backtrace.join("\n")
24 G.server.logger.error "listen loop error: #{e.inspect}."
25 G.server.logger.error e.backtrace.join("\n")
31 when EOFError, Errno::ECONNRESET, Errno::EPIPE, Errno::EINVAL,
32 Errno::EBADF, Errno::ENOTCONN
33 # swallow error if client shuts down one end or disconnects
34 when Unicorn::HttpParserError
35 Const::ERROR_400_RESPONSE # try to tell the client they're bad
36 when IOError # HttpParserError is an IOError
39 Const::ERROR_500_RESPONSE