Exception: ContractErrors::ContractError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/0xfacet/typed/contract_errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, contract = nil) ⇒ ContractError

Returns a new instance of ContractError.



6
7
8
9
# File 'lib/0xfacet/typed/contract_errors.rb', line 6

def initialize(message, contract = nil)
  super(message)
  @contract = contract
end

Instance Attribute Details

#contractObject

Returns the value of attribute contract.



3
4
5
# File 'lib/0xfacet/typed/contract_errors.rb', line 3

def contract
  @contract
end

#error_statusObject

Returns the value of attribute error_status.



4
5
6
# File 'lib/0xfacet/typed/contract_errors.rb', line 4

def error_status
  @error_status
end

Instance Method Details

#messageObject



11
12
13
14
15
16
17
# File 'lib/0xfacet/typed/contract_errors.rb', line 11

def message
  return super if contract.blank?
  
  trace = !Rails.env.production? ? backtrace.join("\n") : ''
  
  "#{contract.class.name} error: " + super
end