lib/mnemosyne/trace.rb in mnemosyne-ruby-1.7.1 vs lib/mnemosyne/trace.rb in mnemosyne-ruby-1.8.0

- old
+ new

@@ -55,16 +55,17 @@ errors: @errors.map(&:serialize) } end Error = Struct.new(:error) do - BT_REGEXP = /^((?:[a-zA-Z]:)?[^:]+):(\d+)(?::in `([^']+)')?$/ + BT_REGEXP = /^((?:[a-zA-Z]:)?[^:]+):(\d+)(?::in `([^']+)')?$/.freeze def serialize { type: error.class.name, text: error.message.to_s, + cause: serialize_cause, stacktrace: serialize_backtrace }.compact end private @@ -75,9 +76,13 @@ error.backtrace.map do |bt| md = BT_REGEXP.match(bt.to_s).to_a {file: md[1], line: md[2], call: md[3], raw: md[0]} end + end + + def serialize_cause + self.class.new(error.cause).serialize if error.cause end end end end