Skip to content

Commit

Permalink
Handle Exception children in Edge::Future
Browse files Browse the repository at this point in the history
  • Loading branch information
pitr-ch committed Sep 30, 2015
1 parent 59c8b1e commit 2f5af57
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/concurrent/edge/future.rb
Expand Up @@ -132,6 +132,7 @@ def post_on(executor, *args, &job)
class Event < Synchronization::LockableObject
safe_initialization!
include Concern::Deprecation
include Concern::Logging

# @!visibility private
class State
Expand Down Expand Up @@ -885,6 +886,7 @@ def hide_completable
# @!visibility private
class AbstractPromise < Synchronization::Object
safe_initialization!
include Concern::Logging

def initialize(future)
super()
Expand Down Expand Up @@ -928,8 +930,8 @@ def evaluate_to(*args, block)
rescue StandardError => error
complete_with Future::Failed.new(error)
rescue Exception => error
log(ERROR, 'Edge::Future', error)
complete_with Future::Failed.new(error)
raise error
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/edge/future_spec.rb
Expand Up @@ -337,7 +337,7 @@

it 'completes future when Exception raised' do
f = Concurrent.future { raise Exception, 'fail' }
sleep 0.2
f.wait 1
expect(f).to be_completed
expect(f).to be_failed
expect{ f.value! }.to raise_error(Exception, 'fail')
Expand Down

0 comments on commit 2f5af57

Please sign in to comment.