You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The error reporting when a function is wrongly composed is not useful.
To Reproduce
Let's take the example from the documentation
require'dry/transformer'classMapper < Dry::Transformer::PipeimportDry::Transformer::ArrayTransformationsimportDry::Transformer::HashTransformationsdefine!domap_arraydosymbolize_keysrename_keys:user_name,:name# the error is here!nest:address,[:city,:street,:zipcode]endendendmapper=Mapper.newppmapper.([{'user_name'=>'Jane','city'=>'NYC','street'=>'Street 1','zipcode'=>'123'}])
Running the code gives:
Traceback (most recent call last):
11: from example.rb:19:in `<main>'
10: from /home/apohllo/.rvm/gems/ruby-2.7.2/gems/dry-transformer-0.1.1/lib/dry/transformer/pipe.rb:71:in `call'
9: from /home/apohllo/.rvm/gems/ruby-2.7.2/gems/dry-transformer-0.1.1/lib/dry/transformer/function.rb:50:in `call'
8: from /home/apohllo/.rvm/gems/ruby-2.7.2/gems/dry-transformer-0.1.1/lib/dry/transformer/function.rb:50:in `call'
7: from /home/apohllo/.rvm/gems/ruby-2.7.2/gems/dry-transformer-0.1.1/lib/dry/transformer/array.rb:45:in `map_array'
6: from /home/apohllo/.rvm/gems/ruby-2.7.2/gems/dry-transformer-0.1.1/lib/dry/transformer/array.rb:45:in `map'
5: from /home/apohllo/.rvm/gems/ruby-2.7.2/gems/dry-transformer-0.1.1/lib/dry/transformer/array.rb:45:in `block in map_array'
4: from /home/apohllo/.rvm/gems/ruby-2.7.2/gems/dry-transformer-0.1.1/lib/dry/transformer/composite.rb:33:in `call'
3: from /home/apohllo/.rvm/gems/ruby-2.7.2/gems/dry-transformer-0.1.1/lib/dry/transformer/composite.rb:33:in `call'
2: from /home/apohllo/.rvm/gems/ruby-2.7.2/gems/dry-transformer-0.1.1/lib/dry/transformer/function.rb:50:in `call'
1: from /home/apohllo/.rvm/gems/ruby-2.7.2/gems/dry-transformer-0.1.1/lib/dry/transformer/function.rb:50:in `call'
/home/apohllo/.rvm/gems/ruby-2.7.2/gems/dry-transformer-0.1.1/lib/dry/transformer/hash.rb:170:in `rename_keys': wrong number of arguments (given 3, expected 2) (ArgumentError)
Expected behavior
I would like that the stack trace included the line that introduced the error, i.e. the line with the comment. But there is no reference to that line, making debugging of the composed code pretty hard. This stays in contrast with regular ruby code, which would directly indicate the line that has the error.
The text was updated successfully, but these errors were encountered:
Describe the bug
The error reporting when a function is wrongly composed is not useful.
To Reproduce
Let's take the example from the documentation
Running the code gives:
Expected behavior
I would like that the stack trace included the line that introduced the error, i.e. the line with the comment. But there is no reference to that line, making debugging of the composed code pretty hard. This stays in contrast with regular ruby code, which would directly indicate the line that has the error.
The text was updated successfully, but these errors were encountered: