-
Notifications
You must be signed in to change notification settings - Fork 68
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
Unnecessary airbrake error when running unknown rake task #13
Comments
The same also happens for any rake task (even if it was successful) if Airbrake is not configured. |
Fixes #13 (Unnecessary airbrake error when running unknown rake task) The problem with Rake is that on unknown task it [raises SystemExit][1] with help of [`Kernel.exit`][2], which we catch and try to send to Airbrake, which results in an Airbrake::Error. This is the easiest fix. I tried messing with the airbrake gem to load the Airbrake config when you launch a Rake task inside a Rails app, but it's not easy to do: the Rails app is not initialised at that moment. I stopped digging there, because I was getting into the rabbit hole. [1]: https://github.com/ruby/rake/blob/805c13ab52eae9df55f9030f40c7fbc1beadc105/lib/rake/application.rb#L191 [2]: http://ruby-doc.org/core-2.2.3/Kernel.html#method-i-exit
Fixes #13 (Unnecessary airbrake error when running unknown rake task) The problem with Rake is that on unknown task it [raises SystemExit][1] with help of [`Kernel.exit`][2], which we catch and try to send to Airbrake, which results in an Airbrake::Error. This is the easiest fix. I tried messing with the airbrake gem to load the Airbrake config when you launch a Rake task inside a Rails app, but it's not easy to do: the Rails app is not initialised at that moment. I stopped digging there, because I was getting into the rabbit hole. [1]: https://github.com/ruby/rake/blob/805c13ab52eae9df55f9030f40c7fbc1beadc105/lib/rake/application.rb#L191 [2]: http://ruby-doc.org/core-2.2.3/Kernel.html#method-i-exit
Thanks for the bug report. Could you please verify that the fix presented in #14 works for you? Merry Christmas! =) |
Do you mean that Airbrake is always not configured? |
@vmihailenco I think I meant it fails for rake tasks that do not load rails environment. |
@kyrylo Yes, it fixes the problem. Thank you. |
Airbrake config
DescriptionHello, I am having a very similar error to this. It happens when RSpec's rake task exits because of a failing spec. I'm using the latest version ( I removed some irrelevant output from RSpec, but the output I get is this:
Let me know if you would prefer a separate issue for this, I'm posting here since the issue seems fairly similar. |
@rafaelgonzalez what happens when you configure your Airbrake inside |
Do you get the same results with:
|
@kyrylo @rafaelgonzalez I had the same problem of having that stack trace show up when the tests failed when invoking rake. Placing my Airbrake inside Airbrake.configure do |config|
config.project_key = ''
config.project_id = ''
end However, now I cannot run any other rake tasks....So I am just living with it for the moment. |
Please file an issue. This seems to be a different problem. |
@kyrylo, I have answered your questions below, but as per your request have also opened #28 to move the discussion there.
If I add the airbrake config to my require 'simplecov'
SimpleCov.start 'rails'
require 'factory_girl_rails'
require 'airbrake'
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.filter_run :focus
config.run_all_when_everything_filtered = true
config.disable_monkey_patching!
if config.files_to_run.one?
config.default_formatter = 'doc'
end
config.order = :random
Kernel.srand config.seed
config.include FactoryGirl::Syntax::Methods
end
Airbrake.configure do |config|
config.project_id = 'foo'
config.project_key = 'bar'
config.environment = Rails.env # I added this since my previous post, but removing it does not affect this issue
config.ignore_environments = %w(development test)
end Sorry for the verbosity, I just want to give you as much context as possible.
|
Fixes #28 ("Airbrake::Error: the 'default' notifier isn't configured" thrown after unsuccessful specs) This fixes issues with the Rake integration. There was a [similar issue][1] reported a couple of weeks ago. The change presented here fixes both issues by reraising `SystemExit`, which propagates it and gets handled by Ruby. [1]: #13
Fixes #28 ("Airbrake::Error: the 'default' notifier isn't configured" thrown after unsuccessful specs) This fixes issues with the Rake integration. There was a [similar issue][1] to a bug with the Rake integration reported a couple of weeks ago. The change presented here fixes both issues by reraising `SystemExit`, which propagates it and gets handled by Ruby. [1]: #13
Fixes #28 ("Airbrake::Error: the 'default' notifier isn't configured" thrown after unsuccessful specs) This fixes issues with the Rake integration. There was a [similar issue][1] to a bug with the Rake integration reported a couple of weeks ago. The change presented here fixes both issues by reraising `SystemExit`, which propagates it and gets handled by Ruby. [1]: #13
Airbrake config
Description
I checked that my config is OK by running
rake airbrake:test
, it runs successfully.But when I run a rake task that does not exist I am getting the following output:
I think the issue is that in this case airbrake is loaded (through bundler) but initializers are not loaded, so Airbrake config is not loaded.
The text was updated successfully, but these errors were encountered: