Skip to content

Commit 280d9d0

Browse files
committed
Merge pull request #477 from schneems/schneems/better-ivar-error-message
Raise better error when input is not an IVar
2 parents c764483 + 91c5f04 commit 280d9d0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/concurrent/dataflow.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def dataflow_with(executor, *inputs, &block)
3939
call_dataflow(:value, executor, *inputs, &block)
4040
end
4141
module_function :dataflow_with
42-
42+
4343
def dataflow!(*inputs, &block)
4444
dataflow_with!(Concurrent.global_io_executor, *inputs, &block)
4545
end
@@ -50,12 +50,14 @@ def dataflow_with!(executor, *inputs, &block)
5050
end
5151
module_function :dataflow_with!
5252

53-
private
53+
private
5454

5555
def call_dataflow(method, executor, *inputs, &block)
5656
raise ArgumentError.new('an executor must be provided') if executor.nil?
5757
raise ArgumentError.new('no block given') unless block_given?
58-
raise ArgumentError.new('not all dependencies are IVars') unless inputs.all? { |input| input.is_a? IVar }
58+
unless inputs.all? { |input| input.is_a? IVar }
59+
raise ArgumentError.new("Not all dependencies are IVars.\nDependencies: #{ inputs.inspect }")
60+
end
5961

6062
result = Future.new(executor: executor) do
6163
values = inputs.map { |input| input.send(method) }

0 commit comments

Comments
 (0)