Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
0.9.3
-
None
-
None
Description
After closing of issue THRIFT-3335 the Ruby server catches all exceptions from handlers and sends ApplicationException.new(ApplicationException::INTERNAL_ERROR, 'Internal error') losing all information. It makes investigation of rare failures hard.
Possible way for investigation is rewriting of Thrift::Processor::process with printing to stdout
processor.rb
def process(iprot, oprot) name, type, seqid = iprot.read_message_begin if respond_to?("process_#{name}") begin send("process_#{name}", seqid, iprot, oprot) rescue => e p e x = ApplicationException.new(ApplicationException::INTERNAL_ERROR, 'Internal error') write_error(x, oprot, name, seqid) end true else iprot.skip(Types::STRUCT) iprot.read_message_end x = ApplicationException.new(ApplicationException::UNKNOWN_METHOD, 'Unknown function '+name) write_error(x, oprot, name, seqid) false end end
(I used it for debug)
or alternatively wrap the original exception in ApplicationException
processor.rb
def process(iprot, oprot) name, type, seqid = iprot.read_message_begin if respond_to?("process_#{name}") begin send("process_#{name}", seqid, iprot, oprot) rescue => e x = ApplicationException.new(ApplicationException::INTERNAL_ERROR, e.to_s) write_error(x, oprot, name, seqid) end true else iprot.skip(Types::STRUCT) iprot.read_message_end x = ApplicationException.new(ApplicationException::UNKNOWN_METHOD, 'Unknown function '+name) write_error(x, oprot, name, seqid) false end end