Skip to content

Commit

Permalink
trying it with hoptoad
Browse files Browse the repository at this point in the history
  • Loading branch information
coolo committed Dec 14, 2012
1 parent 5e9f2ec commit bd641ee
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ tmp/appdata-factory.xml.gz
.idea
public/assets
tmp/sass-cache
config/options.yml
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ gem 'jquery-rails'
gem 'memcache-client'
gem 'sqlite3'
gem 'minitest', '~> 2.5'
gem 'hoptoad_notifier', "~> 2.3"

group :assets do
gem 'sass-rails' # if running rails 3.1 or greater
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ GEM
gettext_i18n_rails (0.8.0)
fast_gettext (>= 0.4.8)
hike (1.2.1)
hoptoad_notifier (2.4.11)
activesupport
builder
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.1.4)
Expand Down Expand Up @@ -130,6 +133,7 @@ DEPENDENCIES
delayed_job_active_record
gettext (>= 1.9.3)
gettext_i18n_rails (>= 0.4.3)
hoptoad_notifier (~> 2.3)
jquery-rails
memcache-client
minitest (~> 2.5)
Expand Down
7 changes: 2 additions & 5 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ class MissingParameterError < Exception; end

protected

def rescue_action_locally( exception )
rescue_action_in_public( exception )
end

def rescue_action_in_public(exception)
rescue_from Exception do |exception|
logger.debug "rescue"
@message = exception.message
if request.xhr?
render :template => "error", :layout => false, :status => 400
Expand Down
32 changes: 32 additions & 0 deletions config/initializers/hoptoad.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
HoptoadNotifier.configure do |config|
# Change this to some sensible data for your errbit instance
config.api_key = CONFIG['errbit_api_key'] || 'YOUR_ERRBIT_API_KEY'
config.host = CONFIG['errbit_host'] || 'YOUR_ERRBIT_HOST'
if CONFIG['errbit_api_key'].blank? || CONFIG['errbit_host'].blank?
config.development_environments = "production development test"
else
config.development_environments = "development test"
end

config.ignore_only = %w{
ActiveRecord::RecordNotFound
ActionController::InvalidAuthenticityToken
CGI::Session::CookieStore::TamperedWithCookie
ActionController::UnknownAction
AbstractController::ActionNotFound
Timeout::Error
Net::HTTPBadResponse
}

config.ignore_by_filter do |exception_data|
ret=false
if exception_data[:error_class] == "ActionController::RoutingError"
message = exception_data[:error_message]
ret=true if message =~ %r{Required Parameter}
ret=true if message =~ %r{\[GET\]}
ret=true if message =~ %r{Expected AJAX call}
end
ret
end

end
5 changes: 5 additions & 0 deletions config/options.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,10 @@ api_password: test

order_mails_to: promodvds@opensuse.org

# only for production use
#opensuse_cookie:

# see http://colszowka.heroku.com/2011/02/22/setting-up-your-custom-hoptoad-notifier-endpoint-for-free-using-errbit-on-heroku
#errbit_api_key: api_key_of_your_app
#errbit_host: installation.of.errbit.com

2 changes: 0 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
match 'ymp/:project/:repository/:arch/:binary.ymp' => :ymp_with_arch_and_version,
:constrains => { :project => /[\w\-\.:]+/, :repository => /[\w\-\.:]+/, :arch => /[\w\-\.:]+/, :binary => /[\w\-\.:\+]+/ }

#map unavailable version to the latest release
match ':version' => :index, :constraints => { :version => /[\d]+/ }
match ':version/:locale' => :index, :constraints => { :version => /[\d]+/ }
match 'developer/:locale' => :release, :release => "developer"
end
Expand Down

0 comments on commit bd641ee

Please sign in to comment.