Skip to content

Commit 2f5af57

Browse files
committed
Handle Exception children in Edge::Future
1 parent 59c8b1e commit 2f5af57

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/concurrent/edge/future.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ def post_on(executor, *args, &job)
132132
class Event < Synchronization::LockableObject
133133
safe_initialization!
134134
include Concern::Deprecation
135+
include Concern::Logging
135136

136137
# @!visibility private
137138
class State
@@ -885,6 +886,7 @@ def hide_completable
885886
# @!visibility private
886887
class AbstractPromise < Synchronization::Object
887888
safe_initialization!
889+
include Concern::Logging
888890

889891
def initialize(future)
890892
super()
@@ -928,8 +930,8 @@ def evaluate_to(*args, block)
928930
rescue StandardError => error
929931
complete_with Future::Failed.new(error)
930932
rescue Exception => error
933+
log(ERROR, 'Edge::Future', error)
931934
complete_with Future::Failed.new(error)
932-
raise error
933935
end
934936
end
935937

spec/concurrent/edge/future_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@
337337

338338
it 'completes future when Exception raised' do
339339
f = Concurrent.future { raise Exception, 'fail' }
340-
sleep 0.2
340+
f.wait 1
341341
expect(f).to be_completed
342342
expect(f).to be_failed
343343
expect{ f.value! }.to raise_error(Exception, 'fail')

0 commit comments

Comments
 (0)