add base API error messages

This commit is contained in:
Alex Turchyn
2024-01-19 03:03:45 +02:00
committed by Pete Matsyburka
parent 0a00fe6ab8
commit f9ccca1376
4 changed files with 192 additions and 0 deletions
@@ -15,6 +15,10 @@ module Api
before_action :authenticate_user!
check_authorization
rescue_from Params::BaseValidator::InvalidParameterError do |e|
render json: { error: e.message }, status: :unprocessable_entity
end
if Rails.env.production?
rescue_from CanCan::AccessDenied do |e|
Rollbar.error(e) if defined?(Rollbar)