Skip to content

Commit

Permalink
fix 403 error, add error catching and logging
Browse files Browse the repository at this point in the history
  • Loading branch information
compwron committed Apr 15, 2024
1 parent ccdb08b commit 05d7317
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ApplicationController < ActionController::Base

rescue_from Pundit::NotAuthorizedError, with: :not_authorized
rescue_from Organizational::UnknownOrganization, with: :not_authorized
rescue_from StandardError, with: :log_and_reraise

impersonates :user

Expand Down Expand Up @@ -134,6 +135,11 @@ def not_authorized
redirect_to(root_url)
end

def log_and_reraise(error)
Bugsnag.notify(error)
raise error
end

def check_unconfirmed_email_notice(user)
notice = "#{user.role} was successfully updated."
if user.saved_changes.include?("unconfirmed_email")
Expand Down
2 changes: 1 addition & 1 deletion public/403.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<title>We're sorry, but something went wrong (403)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
.rails-default-error-page {
Expand Down

0 comments on commit 05d7317

Please sign in to comment.