Capture exception on sentry if something is wrong
This commit is contained in:
parent
1e7b5a56e4
commit
7fbe5dda98
2 changed files with 11 additions and 1 deletions
|
@ -1,7 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ErrorsController < ApplicationController
|
class ErrorsController < ApplicationController
|
||||||
rescue_from Exception do
|
rescue_from StandardError do |exception|
|
||||||
|
Sentry.capture_exception(exception)
|
||||||
# catch any error, except errors triggered by middlewares outside controller (like warden middleware)
|
# catch any error, except errors triggered by middlewares outside controller (like warden middleware)
|
||||||
render file: Rails.public_path.join('500.html'), layout: false, status: :internal_server_error
|
render file: Rails.public_path.join('500.html'), layout: false, status: :internal_server_error
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,6 +3,15 @@
|
||||||
describe 'Errors handling', js: false do
|
describe 'Errors handling', js: false do
|
||||||
let(:procedure) { create(:procedure) }
|
let(:procedure) { create(:procedure) }
|
||||||
|
|
||||||
|
scenario 'not found returns 404' do
|
||||||
|
without_detailed_exceptions do
|
||||||
|
visit '/nonexistent-path'
|
||||||
|
end
|
||||||
|
|
||||||
|
expect(page).to have_http_status(:not_found)
|
||||||
|
expect(page).to have_content('Page non trouvée')
|
||||||
|
end
|
||||||
|
|
||||||
scenario 'bug renders dynamic 500 page' do
|
scenario 'bug renders dynamic 500 page' do
|
||||||
procedure.revisions.destroy_all # break procedure
|
procedure.revisions.destroy_all # break procedure
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue