Skip to content

Commit 91c5f04

Browse files
committed
Raise better error when input is not an IVar
This will show the values received such as: ``` rgumentError: Not all dependencies are IVars. Dependencies: [false] /Users/richardschneeman/.gem/ruby/2.3.0/gems/concurrent-ruby-1.0.0/lib/concurrent/dataflow.rb:61:in `call_dataflow' /Users/richardschneeman/.gem/ruby/2.3.0/gems/concurrent-ruby-1.0.0/lib/concurrent/dataflow.rb:40:in `dataflow_with' /Users/richardschneeman/.gem/ruby/2.3.0/gems/concurrent-ruby-1.0.0/lib/concurrent/dataflow.rb:35:in `dataflow' /Users/richardschneeman/Documents/projects/sprockets/lib/sprockets/manifest.rb:203:in `block in compile' /Users/richardschneeman/Documents/projects/sprockets/lib/sprockets/manifest.rb:131:in `block (2 levels) in find' /Users/richardschneeman/Documents/projects/sprockets/lib/sprockets/base.rb:76:in `find_all_linked_assets' /Users/richardschneeman/Documents/projects/sprockets/lib/sprockets/manifest.rb:130:in `block in find' /Users/richardschneeman/Documents/projects/sprockets/lib/sprockets/manifest.rb:129:in `each' /Users/richardschneeman/Documents/projects/sprockets/lib/sprockets/manifest.rb:129:in `find' /Users/richardschneeman/Documents/projects/sprockets/lib/sprockets/manifest.rb:164:in `compile' /Users/richardschneeman/.gem/ruby/2.3.0/bundler/gems/sprockets-rails-ad4a43bd1bb1/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define' /Users/richardschneeman/Documents/projects/sprockets/lib/rake/sprocketstask.rb:147:in `with_logger' /Users/richardschneeman/.gem/ruby/2.3.0/bundler/gems/sprockets-rails-ad4a43bd1bb1/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define' ```
1 parent c764483 commit 91c5f04

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)