EDI web translator stacktrace capture
authorBill Erickson <berick@esilibrary.com>
Fri, 27 Jul 2012 15:02:27 +0000 (11:02 -0400)
committerBill Erickson <berick@esilibrary.com>
Fri, 27 Jul 2012 15:12:32 +0000 (11:12 -0400)
When the ruby libs fail parsing the JSON (jedi) message, send the
ruby stacktrace to a file for later investigation.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/edi_translator/edi_webrick.rb

index 4907dd0..798447f 100755 (executable)
@@ -100,8 +100,13 @@ servlet.add_handler("edi2json"  ) { |a_string|
 }
 servlet.add_handler("json2edi"  ) { |a_string|
   File.open('/tmp/ruby_json2edi.tmp', 'w') {|f| f.write(a_string) }      # debugging, so we can compare what we rec'd w/ the orig. file
-  @map = OpenILS::Mapper.from_json(a_string)
-  @map.to_s
+  begin
+    @map = OpenILS::Mapper.from_json(a_string)
+    @map.to_s
+  rescue => exc
+    File.open('/tmp/edi_webrick-exception', 'w') {|f| f.write(exc.backtrace.inspect) }
+    raise "#{exc.message}: #{exc.backtrace}"
+  end
 }
 servlet.add_introspection