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

Extremely opaque error message for `layout '*', :erb` #914

Closed
whitequark opened this Issue Jul 21, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@whitequark
Contributor

whitequark commented Jul 21, 2016

To reproduce, let's have no content and just this in Rules:

layout '*', :erb

Running nanoc gives:

Crashlog created at 2016-07-21 04:47:39 +0000

===== MESSAGE:

NoMethodError: undefined method `[]' for nil:NilClass

===== COMPILATION STACK:

  (empty)

===== STACK TRACE:

  0. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/rule_dsl/rule_memory_calculator.rb:88:in `block in new_rule_memory_for_layout'
  1. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/rule_dsl/rule_memory_calculator.rb:87:in `tap'
  2. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/rule_dsl/rule_memory_calculator.rb:87:in `new_rule_memory_for_layout'
  3. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/rule_dsl/rule_memory_calculator.rb:36:in `[]'
  4. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/base/memoization.rb:87:in `block in memoize'
  5. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/rule_dsl/action_provider.rb:36:in `memory_for'
  6. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/base/compilation/compiler.rb:114:in `block in store'
  7. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/base/compilation/compiler.rb:113:in `each'
  8. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/base/compilation/compiler.rb:113:in `store'
  9. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/base/compilation/compiler.rb:90:in `run'
  10. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/base/compilation/compiler.rb:77:in `run_all'
  11. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/base/entities/site.rb:30:in `compile'
  12. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/cli/commands/compile.rb:367:in `block in run'
  13. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/cli/commands/compile.rb:409:in `run_listeners_while'
  14. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/cli/commands/compile.rb:366:in `run'
  15. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/cli/command_runner.rb:12:in `block in call'
  16. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/cli/error_handler.rb:64:in `handle_while'
  17. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/cli/error_handler.rb:22:in `handle_while'
  18. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/cli/command_runner.rb:11:in `call'
  19. /home/whitequark/.gem/ruby/2.3.0/gems/cri-2.7.0/lib/cri/command_dsl.rb:233:in `block in runner'
  20. /home/whitequark/.gem/ruby/2.3.0/gems/cri-2.7.0/lib/cri/command.rb:294:in `run_this'
  21. /home/whitequark/.gem/ruby/2.3.0/gems/cri-2.7.0/lib/cri/command.rb:247:in `run'
  22. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/cli/commands/nanoc.rb:37:in `block in define'
  23. /home/whitequark/.gem/ruby/2.3.0/gems/cri-2.7.0/lib/cri/command.rb:294:in `run_this'
  24. /home/whitequark/.gem/ruby/2.3.0/gems/cri-2.7.0/lib/cri/command.rb:247:in `run'
  25. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/cli.rb:53:in `block in run'
  26. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/cli/error_handler.rb:64:in `handle_while'
  27. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/cli/error_handler.rb:22:in `handle_while'
  28. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/lib/nanoc/cli.rb:51:in `run'
  29. /home/whitequark/.gem/ruby/2.3.0/gems/nanoc-4.2.3/bin/nanoc:9:in `<top (required)>'
  30. /home/whitequark/.gem/ruby/2.3.0/bin/nanoc:23:in `load'

There is no indication of what's wrong whatsoever. This is not good.

@Bike

This comment has been minimized.

Show comment
Hide comment
@Bike

Bike Jul 21, 2016

the direct site of the error mentions this problem as a potential, i feel i should mention (I am the one who ran into this but I have very little nanoc experience)

Bike commented Jul 21, 2016

the direct site of the error mentions this problem as a potential, i feel i should mention (I am the one who ran into this but I have very little nanoc experience)

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Jul 21, 2016

Member

Oh, facepalm. res being nil will indeed throw a weird error (it’s still an erroneous condition, but the message could be far more helpful).

Member

ddfreyne commented Jul 21, 2016

Oh, facepalm. res being nil will indeed throw a weird error (it’s still an erroneous condition, but the message could be far more helpful).

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Jul 24, 2016

Member

Fixed in #916.

Member

ddfreyne commented Jul 24, 2016

Fixed in #916.

@ddfreyne ddfreyne closed this Jul 24, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment