Skip to content

Improve cron_jobs loading error messages

Gabriel Mazetto requested to merge bug/sidekiq-cron-better-error into master

What does this MR do?

Improves the error message from "Sidekiq Cron Jobs" plugin, when trying to load a incorrect definition from gitlab config files.

This is the output before the fix:

2016-06-08T16:43:19.277Z 2890 TID-gso49ojro INFO: Booting Sidekiq 4.1.2 with redis options {:url=>"unix:/var/run/redis/redis.sock", :namespace=>"resque:gitlab"}
undefined method `delete' for nil:NilClass
/home/git/gitlab/config/initializers/sidekiq.rb:16:in `block (2 levels) in <top (required)>'
/home/git/gitlab/config/initializers/sidekiq.rb:16:in `each'
/home/git/gitlab/config/initializers/sidekiq.rb:16:in `block in <top (required)>'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-4.1.2/lib/sidekiq.rb:70:in `configure_server'

This is the output after the fix:

2016-07-18T10:53:22.414Z 66332 TID-oxal1bmik INFO: Booting Sidekiq 4.1.4 with redis options {:url=>"redis://localhost:6378", :namespace=>"resque:gitlab"}
Invalid cron_jobs config key: 'registry'. Check your gitlab config file.
/home/git/gitlab/config/initializers/sidekiq.rb:21:in `block (2 levels) in <top (required)>'
/home/git/gitlab/config/initializers/sidekiq.rb:17:in `each'
/home/git/gitlab/config/initializers/sidekiq.rb:17:in `block in <top (required)>'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/ruby-2.1.8/gems/sidekiq-4.1.4/lib/sidekiq.rb:70:in `configure_server'

Fixes #18378 (closed)

Are there points in the code the reviewer needs to double check?

No

Why was this MR needed?

Original error doesn't give any hint on where the problem can be, so the user can't easily troubleshoot unless he knows implementation details.

What are the relevant issue numbers?

#18378 (closed)

Does this MR meet the acceptance criteria?

Merge request reports