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

Unhelpful error message when text filter returns nil #1323

Closed
agross opened this Issue Feb 27, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@agross
Contributor

agross commented Feb 27, 2018

When a textual filter returns nil (as I did when I forgot to return content), you get this error message:

Loading site... done
Compiling site...

Captain! We've been hit!

  ... 8 lines omitted (see crash.log for details)
  9. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/action_sequence.rb:50:in `each'
  8. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/action_sequence.rb:50:in `each'
  7. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/action_sequence.rb:50:in `block in each'
  6. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/compiler/phases/recalculate.rb:32:in `block in run'
  5. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/executor.rb:65:in `layout'
  4. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/executor.rb:92:in `assigns_for'
  3. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/compilation_context.rb:41:in `assigns_for'
  2. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/content.rb:71:in `string'
  1. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/lazy_value.rb:18:in `value'
  D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/lazy_value.rb:18:in `delete'

FrozenError: can't modify frozen Hash
You attempted to modify immutable data. Some data cannot be modified once compilation has started. Such data includes content and attributes of items and layouts, and filter arguments.

Current item: /index.html (:default representation)

A detailed crash log has been written to ./crash.log.

Steps to reproduce

class Foo < Nanoc::Filter
  identifier :foo
  type :text

  def run(content, params = {})
  end
end
  1. Add the filter above and add a compilation rule
  2. bundle exec nanoc compile

Expected behavior

Some error that I might have forgotten to return something or nanoc using nil or nanoc translating nil to ''.

Actual behavior

Error message above.

Crash log


Crashlog created at 2018-02-27 01:33:00 +0100

===== MESSAGE:

FrozenError: can't modify frozen Hash
You attempted to modify immutable data. Some data cannot be modified once compilation has started. Such data includes content and attributes of items and layouts, and filter arguments.

===== ITEM BEING COMPILED:

Current item: /index.html (:default representation)

===== STACK TRACE:

  1. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/compiler/phases/resume.rb:41:in `block in fiber_for'
  2. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/compiler/phases/resume.rb:14:in `block in run'
  3. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/compiler/phases/abstract.rb:23:in `block in call'
  4. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/compiler/phases/abstract.rb:21:in `call'
  5. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/compiler/phases/cache.rb:23:in `run'
  6. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/compiler/phases/abstract.rb:23:in `block in call'
  7. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/compiler/phases/abstract.rb:21:in `call'
  8. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/compiler/phases/recalculate.rb:27:in `run'
  9. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/action_sequence.rb:50:in `each'
  10. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/action_sequence.rb:50:in `each'
  11. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/action_sequence.rb:50:in `block in each'
  12. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/compiler/phases/recalculate.rb:32:in `block in run'
  13. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/executor.rb:65:in `layout'
  14. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/executor.rb:92:in `assigns_for'
  15. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/compilation_context.rb:41:in `assigns_for'
  16. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/content.rb:71:in `string'
  17. from D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/lazy_value.rb:18:in value' D:/Dropbox/Apps/Ruby/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/lazy_value.rb:18:indelete'

===== VERSION INFORMATION:

Nanoc 4.9.1 © 2007-2018 Denis Defreyne.
Running ruby 2.5.0 (2017-12-25) on x64-mingw32 with RubyGems 2.7.3.

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Feb 27, 2018

Member

@agross Is that the full crash log? The stack trace is missing parts!

Member

ddfreyne commented Feb 27, 2018

@agross Is that the full crash log? The stack trace is missing parts!

@agross

This comment has been minimized.

Show comment
Hide comment
@agross

agross Feb 27, 2018

Contributor

@ddfreyne Yes, the details section was copied from crash log (the extra empty lines were added by GitHub, though).

Contributor

agross commented Feb 27, 2018

@ddfreyne Yes, the details section was copied from crash log (the extra empty lines were added by GitHub, though).

@agross

This comment has been minimized.

Show comment
Hide comment
@agross

agross Feb 27, 2018

Contributor

On macOS:

Loading site… done
Compiling site…

Captain! We’ve been hit!

  ... 8 lines omitted (see crash.log for details)
  9. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/action_sequence.rb:50:in `each'
  8. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/action_sequence.rb:50:in `each'
  7. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/action_sequence.rb:50:in `block in each'
  6. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/compiler/phases/recalculate.rb:32:in `block in run'
  5. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/executor.rb:65:in `layout'
  4. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/executor.rb:92:in `assigns_for'
  3. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/compilation_context.rb:41:in `assigns_for'
  2. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/content.rb:71:in `string'
  1. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/lazy_value.rb:18:in `value'
  /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/lazy_value.rb:18:in `delete'

FrozenError: can't modify frozen Hash
You attempted to modify immutable data. Some data cannot be modified once compilation has started. Such data includes content and attributes of items and layouts, and filter arguments.

Current item: /index.html (:default representation)

A detailed crash log has been written to ./crash.log.

crash.log

Contributor

agross commented Feb 27, 2018

On macOS:

Loading site… done
Compiling site…

Captain! We’ve been hit!

  ... 8 lines omitted (see crash.log for details)
  9. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/action_sequence.rb:50:in `each'
  8. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/action_sequence.rb:50:in `each'
  7. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/action_sequence.rb:50:in `block in each'
  6. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/compiler/phases/recalculate.rb:32:in `block in run'
  5. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/executor.rb:65:in `layout'
  4. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/executor.rb:92:in `assigns_for'
  3. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/services/compilation_context.rb:41:in `assigns_for'
  2. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/content.rb:71:in `string'
  1. from /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/lazy_value.rb:18:in `value'
  /Users/agross/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/nanoc-4.9.1/lib/nanoc/base/entities/lazy_value.rb:18:in `delete'

FrozenError: can't modify frozen Hash
You attempted to modify immutable data. Some data cannot be modified once compilation has started. Such data includes content and attributes of items and layouts, and filter arguments.

Current item: /index.html (:default representation)

A detailed crash log has been written to ./crash.log.

crash.log

@ddfreyne ddfreyne closed this in #1326 Mar 3, 2018

ddfreyne added a commit that referenced this issue Mar 3, 2018

Merge pull request #1326 from nanoc/gh-1323
Raise proper error when filter returns nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment