summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordanielsdeleo <dan@getchef.com>2015-01-27 14:51:06 -0800
committerdanielsdeleo <dan@getchef.com>2015-01-27 14:51:06 -0800
commit606c36f731ff6af0ae24c603229097f18537a6f3 (patch)
treea06117ff9fe816a5419e5584c39f62d6afa59393 /lib
parentc8d59328d6ed3b1e4fb45c4d08bbf20a3be59e71 (diff)
downloadchef-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.rb8
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