class BloodContracts::Instrumentation::FailedMatch

Wrapper for exception happend during the match instrumentation Should not be used in the app, to distinguish between expected and unexpected failures

Public Class Methods

new(exception, context: {}) click to toggle source

Initialize failure type with exception

@param value [Exception] rescued exception from the type match @option context [Hash] shared context of matching pipeline

@return [FailedMatch]

# File lib/blood_contracts/instrumentation/failed_match.rb, line 16
def initialize(exception, context: {})
  @errors = []
  @context = context
  @value = exception
  @context[:exception] = exception
end

Public Instance Methods

exception() click to toggle source

Reader for the exception caught

@return [Exception]

# File lib/blood_contracts/instrumentation/failed_match.rb, line 36
def exception
  @context[:exception]
end
valid?() click to toggle source

Predicate, whether the data is valid or not (for the ExceptionCaught it is always False)

@return [Boolean]

# File lib/blood_contracts/instrumentation/failed_match.rb, line 28
def valid?
  false
end