diff options
author | danielsdeleo <dan@getchef.com> | 2015-01-27 14:51:06 -0800 |
---|---|---|
committer | danielsdeleo <dan@getchef.com> | 2015-01-27 14:51:06 -0800 |
commit | 606c36f731ff6af0ae24c603229097f18537a6f3 (patch) | |
tree | a06117ff9fe816a5419e5584c39f62d6afa59393 /lib | |
parent | c8d59328d6ed3b1e4fb45c4d08bbf20a3be59e71 (diff) | |
download | chef-zero-606c36f731ff6af0ae24c603229097f18537a6f3.tar.gz |
Set backtraces on "nested" exceptions
Future ruby has automagic nested exceptions but with current ruby
raising a new exception during rescue obscures the backtrace
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef_zero/data_store/v1_to_v2_adapter.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef_zero/data_store/v1_to_v2_adapter.rb b/lib/chef_zero/data_store/v1_to_v2_adapter.rb index 576f27d..d9ea6e1 100644 --- a/lib/chef_zero/data_store/v1_to_v2_adapter.rb +++ b/lib/chef_zero/data_store/v1_to_v2_adapter.rb @@ -112,9 +112,13 @@ module ChefZero begin yield rescue DataAlreadyExistsError => e - raise DataAlreadyExistsError.new([ 'organizations', single_org ] + e.path, e) + err = DataAlreadyExistsError.new([ 'organizations', single_org ] + e.path, e) + err.set_backtrace(e.backtrace) + raise err rescue DataNotFoundError => e - raise DataNotFoundError.new([ 'organizations', single_org ] + e.path, e) + err = DataNotFoundError.new([ 'organizations', single_org ] + e.path, e) + err.set_backtrace(e.backtrace) + raise e end end |