Skip to content

Commit

Permalink
Merge pull request #49 from nebtrx/refactor-rescue-exception
Browse files Browse the repository at this point in the history
Refactor `rescue Exception`
  • Loading branch information
rafaelfranca authored Nov 14, 2016
2 parents 98d027c + 841620b commit 616a607
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/state_machines/transition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def inspect
def pausable
begin
halted = !catch(:halt) { yield; true }
rescue Exception => error
rescue => error
raise unless @resume_block
end

Expand Down
4 changes: 2 additions & 2 deletions lib/state_machines/transition_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def rollback
def catch_exceptions
begin
yield
rescue Exception
rescue
rollback
raise
end
Expand Down Expand Up @@ -210,7 +210,7 @@ def run_callbacks(index = 0)
# Rollback only if exceptions occur during before callbacks
begin
super
rescue Exception
rescue
rollback unless @before_run
@success = nil # mimics ActiveRecord.save behavior on rollback
raise
Expand Down

0 comments on commit 616a607

Please sign in to comment.