Skip to content

Commit

Permalink
🛠️ Neighborhood: Send Authorization errors to Sentry (#1227)
Browse files Browse the repository at this point in the history
🧹 `Neighborhood`: Send Authorization errors to Sentry

- #892

Piikup-Sandbox is experiencing some sadness because of policy issues it
seems.
  • Loading branch information
zspencer authored Mar 18, 2023
1 parent a1cc586 commit 80cf904
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ApplicationController < ActionController::Base

include Pagy::Backend

rescue_from Pundit::NotAuthorizedError, with: :render_not_found
rescue_from Pundit::NotAuthorizedError, with: :handle_unauthorized
prepend_view_path "app/utilities"
prepend_view_path "app/furniture"

Expand Down Expand Up @@ -140,6 +140,11 @@ def space_repository
current_space.entrance
end

def handle_unauthorized(exception)
Sentry.capture_exception(exception, level: :warn)
render_not_found
end

def render_not_found
render file: "#{Rails.root}/public/404.html", layout: false, status: :not_found
end
Expand Down

0 comments on commit 80cf904

Please sign in to comment.