lib/trailblazer/finder/activities/prepare_adapter.rb in trailblazer-finder-0.90.0 vs lib/trailblazer/finder/activities/prepare_adapter.rb in trailblazer-finder-0.91.0

- old
+ new

@@ -7,19 +7,20 @@ def set_adapter(ctx, **) ctx[:adapter] = ctx.dig(:config, :adapter) || "Basic" end def validate_adapter(_ctx, adapter:, **) - (ORM_ADAPTERS + ["Basic"]).include? adapter.to_s + ORM_ADAPTERS.(adapter.to_s) end - def invalid?((ctx, _flow_options), **_circuit_options) + def invalid?(_e, (ctx, _flow_options), **_circuit_options) (ctx[:errors] ||= []) << {adapter: "The specified adapter are invalid"} end step :set_adapter - step :validate_adapter - fail :invalid? + step Rescue(Dry::Types::ConstraintError, handler: :invalid?) { + step :validate_adapter + } end end end end