Exception: BSV::Script::ScriptError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/bsv/script/interpreter/error.rb

Overview

Error raised during script execution.

Carries a machine-readable error code from ScriptErrorCode alongside a human-readable message.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, message = nil) ⇒ ScriptError

Returns a new instance of ScriptError.

Parameters:

  • code (Symbol)
  • message (String, nil) (defaults to: nil)

    human-readable description (auto-generated from code if omitted)



15
16
17
18
# File 'lib/bsv/script/interpreter/error.rb', line 15

def initialize(code, message = nil)
  @code = code
  super(message || code.to_s.tr('_', ' '))
end

Instance Attribute Details

#codeSymbol (readonly)

Returns the error code from BSV::Script::ScriptErrorCode.

Returns:



11
12
13
# File 'lib/bsv/script/interpreter/error.rb', line 11

def code
  @code
end