Exception: WLang::EvalError

Inherits:
Error
  • Object
show all
Defined in:
lib/wlang/errors.rb

Overview

Raised by hosted languages when something fails during evaluation.

Direct Known Subclasses

UndefinedVariableError

Instance Attribute Summary collapse

Attributes inherited from Error

#cause, #parser_state

Instance Method Summary collapse

Methods inherited from Error

#wlang_backtrace

Constructor Details

#initialize(msg = nil, parser_state = nil, expression = nil, cause = nil) ⇒ EvalError

Creates an error instance with an optional expression that failed



40
41
42
43
# File 'lib/wlang/errors.rb', line 40

def initialize(msg = nil, parser_state = nil, expression = nil, cause = nil)
  super(msg, parser_state, cause)
  @expression = expression
end

Instance Attribute Details

#expressionObject

The expression whose evaluation failed



36
37
38
# File 'lib/wlang/errors.rb', line 36

def expression
  @expression
end

Instance Method Details

#to_sObject



45
46
47
# File 'lib/wlang/errors.rb', line 45

def to_s
  "Evaluation of #{@expression} failed, #{@cause ? @cause.message : ''}"
end