diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2019-01-09 13:34:51 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2019-01-09 13:34:51 -0800 |
commit | e07a9d845410db939c22d357fdcebca5a7b00006 (patch) | |
tree | 36540abdd3e1e6286f6da14b4674e91c939d93f3 /lib | |
parent | 28e6e8b8aa606fd67a3a1e02ee08d2f6b24b185d (diff) | |
download | psych-e07a9d845410db939c22d357fdcebca5a7b00006.zip |
Round trip exception backtraces
This commit allows exception backtraces to round trip
Diffstat (limited to 'lib')
-rw-r--r-- | lib/psych/visitors/to_ruby.rb | 2 | ||||
-rw-r--r-- | lib/psych/visitors/yaml_tree.rb | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/psych/visitors/to_ruby.rb b/lib/psych/visitors/to_ruby.rb index 74a52df..c265acb 100644 --- a/lib/psych/visitors/to_ruby.rb +++ b/lib/psych/visitors/to_ruby.rb @@ -252,6 +252,8 @@ module Psych e = build_exception((resolve_class($1) || class_loader.exception), h.delete('message')) + + e.set_backtrace h.delete('backtrace') if h.key? 'backtrace' init_with(e, h, o) when '!set', 'tag:yaml.org,2002:set' diff --git a/lib/psych/visitors/yaml_tree.rb b/lib/psych/visitors/yaml_tree.rb index bc7d235..62d1d5c 100644 --- a/lib/psych/visitors/yaml_tree.rb +++ b/lib/psych/visitors/yaml_tree.rb @@ -472,6 +472,9 @@ module Psych accept msg end + @emitter.scalar 'backtrace', nil, nil, true, false, Nodes::Scalar::ANY + accept o.backtrace + dump_ivars o @emitter.end_mapping |