lib/em-http-server/server.rb in em-http-server-0.1.1 vs lib/em-http-server/server.rb in em-http-server-0.1.2
- old
+ new
@@ -27,10 +27,15 @@
# invoke the method in the user-provided instance
if respond_to?(:process_http_request)
process_http_request
end
+ rescue Exception => e
+ # invoke the method in the user-provided instance
+ if respond_to?(:http_request_errback)
+ http_request_errback
+ end
end
# parse the first HTTP header line
# get the http METHOD, URI and PROTOCOL
def parse_first_header(line)
@@ -58,9 +63,10 @@
string << "Content-type: text/plain\r\n"
string << "\r\n"
string << "Detected error: HTTP code #{code}"
send_data string
close_connection_after_writing
+ raise("server error #{code}")
end
end
end
end
\ No newline at end of file