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