Exception: Kobako::Transport::Error

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

Overview

Kobako::SandboxError subclass raised when the host detects a structural violation of the wire contract while reading what the guest produced — an invocation value the payload codec cannot decode. Distinct from a Wasm trap (engine signalled the guest runtime is unrecoverable) and from a normal sandbox-layer failure (the script raised but the protocol was respected): a Transport::Error always indicates the guest runtime is corrupted — the only safe recovery is to discard the Sandbox and start a new invocation.

Inherits from Kobako::SandboxError so a single rescue Kobako::SandboxError still catches it; callers that want to distinguish wire-violation paths from script failures can rescue Kobako::Transport::Error directly.

Instance Attribute Summary

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, diagnostic: nil) ⇒ Error

Returns a new instance of Error.



22
23
24
25
# File 'lib/kobako/transport/error.rb', line 22

def initialize(message, diagnostic: nil, **)
  super(message, **)
  @diagnostic = diagnostic
end

Instance Method Details

#detailed_messageString

The codec fault behind this violation, appended to Ruby's own rendering. A caller cannot act on the inner "Symbol payload must be …" wording, so it stays out of #message; an operator triaging a corrupted runtime still needs it, and detailed_message is where Ruby puts text of exactly that kind.

Parameters:

  • highlight: (Boolean)
  • (Object)

Returns:

  • (String)


32
33
34
35
36
37
# File 'lib/kobako/transport/error.rb', line 32

def detailed_message(...)
  rendered = super
  return rendered if @diagnostic.nil?

  "#{rendered}\n#{@diagnostic}"
end