Sha256: 05a92c4489d27472f087c28adeb38f0b8046531fefc5d3c5f1e1aa272b5970de

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

module ContractErrors
  class ContractError < StandardError
    attr_accessor :contract
    attr_accessor :error_status
  
    def initialize(message, contract = nil)
      super(message)
      @contract = contract
    end
    
    def message
      return super if contract.blank?
      
      trace = !Rails.env.production? ? backtrace.join("\n") : ''
      
      "#{contract.class.name} error: " + super
    end
  end
  
  class StaticCallError < StandardError; end  
  class TransactionError < StandardError; end
  class ContractRuntimeError < ContractError; end
  class ContractDefinitionError < ContractError; end
  class StateVariableTypeError < StandardError; end
  class VariableTypeError < StandardError; end
  class StateVariableMutabilityError < StandardError; end
  class ContractArgumentError < StandardError; end
  class CallingNonExistentContractError < TransactionError; end
  class InvalidOverrideError < StandardError; end
  class FunctionAlreadyDefinedError < StandardError; end
  class InvalidEthscriptionError < StandardError; end
  class InvalidDestructuringError < StandardError; end
  class InvalidStateVariableChange < StandardError; end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
0xfacet-typed-0.1.0 lib/0xfacet/typed/contract_errors.rb
0xfacet-typed-0.0.1 lib/0xfacet/typed/contract_errors.rb