class Linearly::Errors::BrokenContract

{BrokenContract} is what happens when inputs or outputs for a {Step} do not match expectations. @abstract

Attributes

failures[R]

Input/output validation failures

@return [Hash<Symbol, Validation::Failure>] @api public @example

err = Linearly::Errors::Inputs.new(
  key: Linearly::Validation::Failure::Missing.instance,
)
err.failures
=> {:key => [missing]}

Public Class Methods

new(source, failures) click to toggle source

Constructor for a {BrokenContract} error

@param source [Object] @param failures [Hash<Symbol, Validation::Failure>]

@api public @example

Linearly::Errors::BrokenContract::Inputs.new(
  Steps::HelloWorld,
  key: Linearly::Validation::Failure::Missing.instance,
)
=> #<Linearly::Errors::BrokenContract::Inputs:
     failed input expectations on Steps::HelloWorld: [key]>
Calls superclass method
# File lib/linearly/errors/broken_contract.rb, line 50
def initialize(source, failures)
  @source = source
  @failures = failures
  super("#{copy} on #{source_string}: [#{keys.join(', ')}]")
end

Private Instance Methods

source_string() click to toggle source

Stringify the source to put it in the error message

@return [String] @api private

# File lib/linearly/errors/broken_contract.rb, line 62
def source_string
  @source.is_a?(Class) ? @source.name : @source.class.name
end