Exception: Kobako::UndefinedEntrypointError

Inherits:
SandboxError show all
Defined in:
lib/kobako/errors.rb,
sig/kobako/errors.rbs

Overview

UndefinedEntrypointError is the SandboxError subclass raised when a #run target names no top-level constant in the guest. It carries the #name that was asked for and the #available names it could have been — the top-level constants the preloaded snippets contributed — so a caller corrects the name from the error rather than by reading the guest source. Ruby pairs NameError#name with NameError#local_variables for the same reason.

Instance Attribute Summary collapse

Attributes included from CarriesExecution

#execution

Attributes included from Diagnosable

#backtrace_lines, #klass, #origin

Instance Method Summary collapse

Methods included from CarriesExecution

#with_execution

Constructor Details

#initialize(message, name: nil, available: []) ⇒ UndefinedEntrypointError

Returns a new instance of UndefinedEntrypointError.



152
153
154
155
156
# File 'lib/kobako/errors.rb', line 152

def initialize(message, name: nil, available: [], **)
  super(message, **)
  @name = name
  @available = available
end

Instance Attribute Details

#availableArray[Symbol] (readonly)

Returns the value of attribute available.

Returns:

  • (Array[Symbol])


150
151
152
# File 'lib/kobako/errors.rb', line 150

def available
  @available
end

#nameSymbol? (readonly)

Returns the value of attribute name.

Returns:

  • (Symbol, nil)


150
151
152
# File 'lib/kobako/errors.rb', line 150

def name
  @name
end