Skip to content

Commit

Permalink
Added Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabyalter committed Jul 8, 2019
1 parent 4472125 commit 1f99a5c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ gem 'unicorn', '~> 5.5.1'

gem 'listen', '~> 3.1'

gem 'sentry-raven', '~> 2.9.0'

group :development do
gem 'better_errors', '~> 2'
gem 'binding_of_caller', '~> 0'
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@ GEM
selenium-webdriver (3.9.0)
childprocess (~> 0.5)
rubyzip (~> 1.2)
sentry-raven (2.9.0)
faraday (>= 0.7.6, < 1.0)
simplecov (0.14.1)
docile (~> 1.1.0)
json (>= 1.8, < 3)
Expand Down Expand Up @@ -542,6 +544,7 @@ DEPENDENCIES
rspec-rails (~> 3)
sass-rails (~> 5.0.6)
selenium-webdriver
sentry-raven (~> 2.9.0)
therubyracer (~> 0.12)
uglifier (~> 3.2.0)
unicorn (~> 5.5.1)
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class ApplicationController < ActionController::Base
rescue_from Timeout::Error, with: :timeout_error
# Resuce exlibris-nyu connection error
rescue_from Faraday::ConnectionFailed, with: :connection_error
before_action :set_raven_context

include Marli::Affiliations
helper_method :affiliation_text, :affiliation, :auth_types
Expand Down Expand Up @@ -122,4 +123,8 @@ def login_path_escaped
CGI::escape("#{Rails.application.config.action_controller.relative_url_root}/login")
end

def set_raven_context
Raven.extra_context(params: params.to_unsafe_h, url: request.url)
end

end
4 changes: 4 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ class Application < Rails::Application
# the framework and any gems in your application.
end
end

Raven.configure do |config|
config.dsn = ENV['SENTRY_DSN']
end

0 comments on commit 1f99a5c

Please sign in to comment.