Fix class check for parameter errors

This commit is contained in:
Andreas Nedbal 2023-02-11 15:41:17 +01:00 committed by Andreas Nedbal
parent 5a192a3598
commit ed20ad9237
1 changed files with 1 additions and 1 deletions

View File

@ -20,7 +20,7 @@ module TurboStreamable
rescue Errors::Base => e rescue Errors::Base => e
render_error I18n.t(e.locale_tag) render_error I18n.t(e.locale_tag)
rescue KeyError, ActionController::ParameterMissing => e rescue KeyError, ActionController::ParameterMissing => e
render_error t("errors.parameter_error", parameter: e.is_a?(KeyError) ? e.key : e.param.capitalize) render_error t("errors.parameter_error", parameter: e.instance_of?(KeyError) ? e.key : e.param.capitalize)
rescue Dry::Types::CoercionError, Dry::Types::ConstraintError rescue Dry::Types::CoercionError, Dry::Types::ConstraintError
render_error t("errors.invalid_parameter") render_error t("errors.invalid_parameter")
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound