class Insights::API::Common::CustomExceptions

Constants

CUSTOM_EXCEPTION_LIST

Public Class Methods

custom_message(exception) click to toggle source
# File lib/insights/api/common/custom_exceptions.rb, line 7
def self.custom_message(exception)
  case exception.class.to_s
  when "Pundit::NotAuthorizedError"
    exception.policy.try(:error_message) ||
      "You are not authorized to perform the #{exception.query.to_s.delete_suffix('?')} action for this #{exception.record.model_name.human.downcase}"
  end
end