diff --git a/app/controllers/api/v0/analytics_controller.rb b/app/controllers/api/v0/analytics_controller.rb index 163c3a3aa..2e3188894 100644 --- a/app/controllers/api/v0/analytics_controller.rb +++ b/app/controllers/api/v0/analytics_controller.rb @@ -4,7 +4,7 @@ module Api respond_to :json rescue_from ArgumentError, with: :error_unprocessable_entity - rescue_from UnauthorizedError, with: :error_unauthorized + rescue_from ApplicationPolicy::NotAuthorizedError, with: :error_unauthorized before_action :authenticate_with_api_key_or_current_user! before_action :authorize_user_organization @@ -49,7 +49,7 @@ module Api return unless analytics_params[:organization_id] @org = Organization.find_by(id: analytics_params[:organization_id]) - raise UnauthorizedError unless @org && @user.org_member?(@org) + raise ApplicationPolicy::NotAuthorizedError unless @org && @user.org_member?(@org) end def load_owner diff --git a/app/errors/unauthorized_error.rb b/app/errors/unauthorized_error.rb deleted file mode 100644 index 6bc84a127..000000000 --- a/app/errors/unauthorized_error.rb +++ /dev/null @@ -1 +0,0 @@ -class UnauthorizedError < StandardError; end