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

More descriptive error messages #3

Closed
Vad1mo opened this issue Aug 9, 2017 · 2 comments · Fixed by #4
Closed

More descriptive error messages #3

Vad1mo opened this issue Aug 9, 2017 · 2 comments · Fixed by #4

Comments

@Vad1mo
Copy link

Vad1mo commented Aug 9, 2017

I am not sure but I thing this error I see now in Portus has something to do with cconfig. However I can't figure out what exactly it is.

Error
undefined method `[]' for nil:NilClass

/portus # rake -v assets:environment 
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
[DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
rake aborted!
NoMethodError: undefined method `[]' for nil:NilClass
/usr/local/bundle/gems/cconfig-1.1.0/lib/cconfig/hash_utils.rb:36:in `enabled?'
/portus/config/initializers/devise.rb:238:in `block in <top (required)>'
/usr/local/bundle/gems/devise-3.5.1/lib/devise.rb:281:in `setup'
/portus/config/initializers/devise.rb:4:in `<top (required)>'
/usr/local/bundle/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load'
/usr/local/bundle/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `block in load'
/usr/local/bundle/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency'
/usr/local/bundle/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load'
/usr/local/bundle/gems/railties-4.2.8/lib/rails/engine.rb:652:in `block in load_config_initializer'
/usr/local/bundle/gems/activesupport-4.2.8/lib/active_support/notifications.rb:166:in `instrument'
/usr/local/bundle/gems/railties-4.2.8/lib/rails/engine.rb:651:in `load_config_initializer'
/usr/local/bundle/gems/railties-4.2.8/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
/usr/local/bundle/gems/railties-4.2.8/lib/rails/engine.rb:615:in `each'
/usr/local/bundle/gems/railties-4.2.8/lib/rails/engine.rb:615:in `block in <class:Engine>'
/usr/local/bundle/gems/railties-4.2.8/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/bundle/gems/railties-4.2.8/lib/rails/initializable.rb:30:in `run'
/usr/local/bundle/gems/railties-4.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/local/bundle/gems/railties-4.2.8/lib/rails/initializable.rb:44:in `each'
/usr/local/bundle/gems/railties-4.2.8/lib/rails/initializable.rb:44:in `tsort_each_child'
/usr/local/bundle/gems/railties-4.2.8/lib/rails/initializable.rb:54:in `run_initializers'
/usr/local/bundle/gems/railties-4.2.8/lib/rails/application.rb:352:in `initialize!'
/portus/config/environment.rb:5:in `<top (required)>'
/usr/local/bundle/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/usr/local/bundle/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/usr/local/bundle/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `block in require'
/usr/local/bundle/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency'
/usr/local/bundle/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `require'
/usr/local/bundle/gems/railties-4.2.8/lib/rails/application.rb:328:in `require_environment!'
/usr/local/bundle/gems/railties-4.2.8/lib/rails/application.rb:457:in `block in run_tasks_blocks'
/usr/local/bundle/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define'
Tasks: TOP => environment
(See full trace by running task with --trace)

@Vad1mo
Copy link
Author

Vad1mo commented Aug 9, 2017

ok I got it.
The line 238 in /portus/config/initializers/devise.rb:238:in block in <top (required)>'isif APP_CONFIG.enabled? "oauth.google_oauth2"` however, I didn't had oauth in the base config yet.

after adding it to the config.yml it started to work.

Not sure if a better error message could indicate what exactly isn't working.

@Vad1mo Vad1mo changed the title undefined method `[]' for nil:NilClass More descriptive error messages Aug 9, 2017
mssola added a commit that referenced this issue Aug 10, 2017
A user reported a crash when you perform
`cfg.enabled?("something.another")` and `something` is a key that
doesn't exist. The fix for this has been to implement a proper general
algorithm for nested cases.

Moreover, I've updated the Gemfile.lock file, since it was still
accounting for the 1.0.0 version...

Fixes #3

Signed-off-by: Miquel Sabaté Solà <[email protected]>
@mssola
Copy link
Owner

mssola commented Aug 10, 2017

@Vad1mo PR #4 should fix this issue. From now on it will simply return false, which is the expected returned value.

@mssola mssola closed this as completed Aug 10, 2017
@mssola mssola reopened this Aug 10, 2017
@mssola mssola closed this as completed in #4 Aug 11, 2017
mssola added a commit to mssola/Portus that referenced this issue Aug 11, 2017
This release includes some fixes that users have already faced.

See SUSE#1379
See mssola/cconfig#3

Signed-off-by: Miquel Sabaté Solà <[email protected]>
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

Successfully merging a pull request may close this issue.

2 participants