Sha256: 8320e7d5cd2c9ee1dfb67856ada3b17993c988ed133c1a8e9a871c08fb0a861b

Contents?: true

Size: 545 Bytes

Versions: 18

Compression:

Stored size: 545 Bytes

Contents

module Datacaster
  module ContextNodes
    class ErrorsCaster < Datacaster::ContextNode
      def initialize(base, error_caster)
        super(base)
        @caster = error_caster
      end

      private

      def transform_errors(errors)
        result = @caster.with_runtime(@runtime).(errors)
        if result.valid?
          result.value
        else
          raise RuntimeError.new("Error caster tried to cast these errors: #{errors.inspect}, but didn't return ValidResult: #{result.inspect}")
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
datacaster-4.1.0 lib/datacaster/context_nodes/errors_caster.rb
datacaster-4.0.1 lib/datacaster/context_nodes/errors_caster.rb
datacaster-3.3.1 lib/datacaster/context_nodes/errors_caster.rb
datacaster-3.3.0 lib/datacaster/context_nodes/errors_caster.rb
datacaster-3.2.7 lib/datacaster/context_nodes/errors_caster.rb
datacaster-3.2.6 lib/datacaster/context_nodes/errors_caster.rb
datacaster-3.2.5 lib/datacaster/context_nodes/errors_caster.rb
datacaster-3.2.4 lib/datacaster/context_nodes/errors_caster.rb
datacaster-3.2.3 lib/datacaster/context_nodes/errors_caster.rb
datacaster-3.2.2 lib/datacaster/context_nodes/errors_caster.rb
datacaster-3.2.1 lib/datacaster/context_nodes/errors_caster.rb
datacaster-3.2.0 lib/datacaster/context_nodes/errors_caster.rb
datacaster-3.1.5 lib/datacaster/context_nodes/errors_caster.rb
datacaster-3.1.3 lib/datacaster/context_nodes/errors_caster.rb
datacaster-3.1.2 lib/datacaster/context_nodes/errors_caster.rb
datacaster-3.1.1 lib/datacaster/context_nodes/errors_caster.rb
datacaster-3.1.0 lib/datacaster/context_nodes/errors_caster.rb
datacaster-3.0.0 lib/datacaster/context_nodes/errors_caster.rb