Exception: Flows::Plugin::OutputContract::ContractError
- Defined in:
- lib/flows/plugin/output_contract/errors.rb
Overview
Raised when result's data violates contract
Instance Method Summary collapse
-
#initialize(klass, result, error) ⇒ ContractError
constructor
A new instance of ContractError.
- #message ⇒ Object
Constructor Details
#initialize(klass, result, error) ⇒ ContractError
Returns a new instance of ContractError.
20 21 22 23 24 |
# File 'lib/flows/plugin/output_contract/errors.rb', line 20 def initialize(klass, result, error) @klass = klass @result = result @error = error end |
Instance Method Details
#message ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/flows/plugin/output_contract/errors.rb', line 26 def shifted_error = @error.split("\n").map { |str| " #{str}" }.join("\n") "Output contract for #{@klass} is violated.\n" \ "Result:\n" \ " `#{@result.inspect}`\n" \ "Contract Error:\n" \ "#{shifted_error}" end |