Exception: ContractBaseError

Inherits:
ArgumentError
  • Object
show all
Defined in:
lib/contracts/errors.rb

Overview

Base class for Contract errors

If default failure callback is used it stores failure data

Direct Known Subclasses

ContractError, PatternMatchingError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, data) ⇒ ContractBaseError

Returns a new instance of ContractBaseError.



10
11
12
13
# File 'lib/contracts/errors.rb', line 10

def initialize(message, data)
  super(message)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



8
9
10
# File 'lib/contracts/errors.rb', line 8

def data
  @data
end

Instance Method Details

#to_contract_errorObject

Used to convert to simple ContractError from other contract errors



16
17
18
# File 'lib/contracts/errors.rb', line 16

def to_contract_error
  self
end