Method: Insights::API::Common::CustomExceptions.custom_message
- Defined in:
- lib/insights/api/common/custom_exceptions.rb
.custom_message(exception) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/insights/api/common/custom_exceptions.rb', line 7 def self.(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 |