-
Notifications
You must be signed in to change notification settings - Fork 419
Raise better error when input is not an IVar #477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raise better error when input is not an IVar #477
Conversation
|
||
def call_dataflow(method, executor, *inputs, &block) | ||
raise ArgumentError.new('an executor must be provided') if executor.nil? | ||
raise ArgumentError.new('no block given') unless block_given? | ||
raise ArgumentError.new('not all dependencies are IVars') unless inputs.all? { |input| input.is_a? IVar } | ||
not_ivars = inputs.map { |input| !input.is_a? IVar } | ||
unless not_ivars.empty? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schneems Thank you for taking the time to work on this update. There are several failing tests we need to look into. I haven't had an opportunity to pull the code and run the tests locally, but I believe this line is the culprit. Won't the #map
function create an array with a number of elements equal to the size of the inputs
array? I think #empty?
will always return false
in this case. Can you please take a look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that should have been a select
, it was right locally but not committed. I'm updating to not allocate an array on every run, will preserve the original logic.
02e2861
to
6a8e4a1
Compare
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' ```
6a8e4a1
to
91c5f04
Compare
Updated to use the original logic, instead of only showing the non conforming inputs, we can easily show all of the inputs. By not using a |
Tests are back to passing |
👍 |
Raise better error when input is not an IVar
This will show the values received such as: