ruby on rails - no such file to load -- config/initializers/airbrake (LoadError) -
ruby on rails - no such file to load -- config/initializers/airbrake (LoadError) -
i wrote simple ror application , raised exception using airbrake. code follows
require 'airbrake' require 'config/initializers/airbrake' begin raise "serious problems happened" params = { :api_key => airbrake.api_key, :error_message => 'notification', :backtrace => caller, :parameters => {}, :session => {} } rescue => e airbrake.notify(:error_class => "special error", :error_message => "spe cial error: #{e.message}", :parameters => params) end
when run above code, i'm getting next exception
/root/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/cus tom_require.rb:55:in `require': no such file load -- config/initializers/airb rake (loaderror) /root/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1 /rubygems/custom_require.rb:55:in `require' sample.rb:2:in `<main>''
but have airbrake.rb in config/initializers, don't know why path not taken.
what issue here
you don't require initializers explicitly. code in config/initializers/ gets automatically loaded application.
furthermore, if you've set airbrake initializer properly, can utilize handy little helper called notify_airbrake
fire off airbrake traces:
begin ... rescue exception => e notify_airbrake e end
that's there it!
ruby-on-rails
Comments
Post a Comment