Skip to content
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

Error messages (call stack) do not render correctly. #423

Open
jontonsoup opened this issue Mar 15, 2013 · 5 comments
Open

Error messages (call stack) do not render correctly. #423

jontonsoup opened this issue Mar 15, 2013 · 5 comments

Comments

@jontonsoup
Copy link

This error happens for all my controllers and views that use rabl (only when there is some sort of error in the file...not during normal use when everything works). The errors in my files can be anything from typos to nil errors, but the same error that is returned to the front end is as follows:

NoMethodError at /api/v1/search_terms/new.json

undefined method `each' for nil:NilClass

(gem) rack-1.4.5/lib/rack/etag.rb, line 58

   53             headers.key?('ETag') || headers.key?('Last-Modified')
   54         end
   55   
   56         def digest_body(body)
   57           parts = []
>  58           body.each { |part| parts << part }
   59           string_body = parts.join
   60           digest = Digest::MD5.hexdigest(string_body) unless string_body.empty?
   61           [digest, parts]
   62         end
   63     end

App backtrace

Full backtrace

  • (gem) rack-1.4.5/lib/rack/etag.rb:58:in `digest_body'
  • (gem) rack-1.4.5/lib/rack/etag.rb:26:in `call'
  • (gem) rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
  • (gem) actionpack-3.2.11/lib/action_dispatch/middleware/head.rb:14:in `call'
  • (gem) actionpack-3.2.11/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  • (gem) actionpack-3.2.11/lib/action_dispatch/middleware/flash.rb:242:in `call'
  • (gem) rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
  • (gem) rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
  • (gem) actionpack-3.2.11/lib/action_dispatch/middleware/cookies.rb:341:in `call'
  • (gem) activerecord-3.2.11/lib/active_record/query_cache.rb:64:in `call'
  • (gem) activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
  • (gem) actionpack-3.2.11/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  • (gem) activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `_run__801243065063069463__call__3087118948779417528__callbacks'
  • (gem) activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback'
  • (gem) activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  • (gem) activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
  • (gem) actionpack-3.2.11/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  • (gem) actionpack-3.2.11/lib/action_dispatch/middleware/reloader.rb:65:in `call'
  • (gem) actionpack-3.2.11/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  • (gem) better_errors-0.7.0/lib/better_errors/middleware.rb:84:in `protected_app_call'
  • (gem) better_errors-0.7.0/lib/better_errors/middleware.rb:79:in `better_errors_call'
  • (gem) better_errors-0.7.0/lib/better_errors/middleware.rb:56:in `call'
  • (gem) actionpack-3.2.11/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  • (gem) actionpack-3.2.11/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  • (gem) railties-3.2.11/lib/rails/rack/logger.rb:32:in `call_app'
  • (gem) railties-3.2.11/lib/rails/rack/logger.rb:18:in `call'
  • (gem) actionpack-3.2.11/lib/action_dispatch/middleware/request_id.rb:22:in `call'
  • (gem) rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
  • (gem) rack-1.4.5/lib/rack/runtime.rb:17:in `call'
  • (gem) activesupport-3.2.11/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  • (gem) rack-1.4.5/lib/rack/lock.rb:15:in `call'
  • (gem) actionpack-3.2.11/lib/action_dispatch/middleware/static.rb:62:in `call'
  • (gem) railties-3.2.11/lib/rails/engine.rb:479:in `call'
  • (gem) railties-3.2.11/lib/rails/application.rb:223:in `call'
  • (gem) railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
  • (gem) rack-1.4.5/lib/rack/deflater.rb:13:in `call'
  • (gem) rack-1.4.5/lib/rack/content_length.rb:14:in `call'
  • (gem) railties-3.2.11/lib/rails/rack/log_tailer.rb:17:in `call'
  • (gem) thin-1.5.0/lib/thin/connection.rb:81:in `block in pre_process'
  • (gem) thin-1.5.0/lib/thin/connection.rb:79:in `pre_process'
  • (gem) thin-1.5.0/lib/thin/connection.rb:54:in `process'
  • (gem) thin-1.5.0/lib/thin/connection.rb:39:in `receive_data'
  • (gem) eventmachine-1.0.1/lib/eventmachine.rb:187:in `run'
  • (gem) thin-1.5.0/lib/thin/backends/base.rb:63:in `start'
  • (gem) thin-1.5.0/lib/thin/server.rb:159:in `start'
  • (gem) rack-1.4.5/lib/rack/handler/thin.rb:13:in `run'
  • (gem) rack-1.4.5/lib/rack/server.rb:268:in `start'
  • (gem) railties-3.2.11/lib/rails/commands/server.rb:70:in `start'
  • (gem) railties-3.2.11/lib/rails/commands.rb:55:in `block in <top (required)>'
  • (gem) railties-3.2.11/lib/rails/commands.rb:50:in `<top (required)>'
  • script/rails:6:in `'
  • script/rails:0:in `'

This error is pretty useless since it doesn't even show a backtrace in the application stack. I'm using:
ruby "1.9.3"

gem 'asset_sync', '0.5.4'
gem 'aws-sdk', '1.3.9'
gem 'jquery-rails', '2.2.0'
gem 'geocoder', '1.1.6'
gem 'haml-rails', "> 0.4"
gem 'newrelic_rpm', '3.5.0.1'
gem 'pg', '0.14.1'
gem 'pg_search', '0.5.7'
gem 'possessive', '1.0.1'
gem 'spree_social', :git => "git://github.com/spree/spree_social.git", :branch => "1-3-stable"
gem 'rails', '3.2.11'
gem 'spree', '1.3.2'
gem 'spree_auth_devise', :github => "spree/spree_auth_devise", :branch => "1-3-stable"
gem 'spree_gateway', :git => 'git://github.com/spree/spree_gateway.git', :branch => "1-3-stable"
gem 'spree_print_invoice' , :git => 'git://github.com/Walk-By/spree_print_invoice.git'
gem "sunspot_autocomplete", ">= 0.0.3", :git => "git://github.com/xponrails/sunspot_autocomplete.git"
gem "sunspot_rails", "
> 2.0.0"
gem 'tax_cloud', '0.2.0'
gem 'thin', '1.5.0'
gem 'urbanairship', '2.2.0'
gem 'haml', '3.1.7'

Any intuition on this?

Thanks,
Jon

@DriesS
Copy link

DriesS commented Apr 23, 2013

You have a fix for this? I encounter also this problem.

@nesquena
Copy link
Owner

Hmm will look into this soon, thanks for bringing it to my attention. Odd

@tispratik
Copy link

+1. I do not see the stack trace showing the line numbers in the rabl file.

@mariozaizar
Copy link

+1 Seeing the Rabl line numbers could be really helpful.

App log:

INFO      Rendered api/v1/foo/bar/index.rabl 
INFO    Completed 500 Internal Server Error in 1348ms

When I render it manually from the console, I see the error.
But I'm still can't see what line number is breaking:

NoMethodError: undefined method `all_activity' for nil:NilClass
  from (eval):4:in `block in render'
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/rabl-0.7.10/lib/rabl/builder.rb:79:in `call'
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/rabl-0.7.10/lib/rabl/builder.rb:79:in `node'
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/rabl-0.7.10/lib/rabl/builder.rb:42:in `block in compile_hash'
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/rabl-0.7.10/lib/rabl/builder.rb:41:in `each'
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/rabl-0.7.10/lib/rabl/builder.rb:41:in `compile_hash'
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/rabl-0.7.10/lib/rabl/builder.rb:21:in `block in build'
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/rabl-0.7.10/lib/rabl/builder.rb:156:in `cache_results'
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/rabl-0.7.10/lib/rabl/builder.rb:20:in `build'
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/rabl-0.7.10/lib/rabl/engine.rb:49:in `to_hash'
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/rabl-0.7.10/lib/rabl/engine.rb:61:in `to_json'
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/rabl-0.7.10/lib/rabl/engine.rb:37:in `block in render'
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/rabl-0.7.10/lib/rabl/engine.rb:277:in `cache_results'
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/rabl-0.7.10/lib/rabl/engine.rb:37:in `render'
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/rabl-0.7.10/lib/rabl/renderer.rb:49:in `render'
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/rabl-0.7.10/lib/rabl.rb:73:in `render'
  from (irb):108
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start'
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start'
  from /home/foo/bar/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>'
  from script/rails:6:in `require'

@nesquena
Copy link
Owner

Anyone interested in helping come up with a pull request for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants