Module: Kobako::Diagnosable

Included in:
SandboxError, ServiceError
Defined in:
lib/kobako/errors.rb,
sig/kobako/errors.rbs

Overview

The structured attribution the two invocation-failure classes carry from a decoded guest exception — its origin, original klass, and backtrace_lines — so a Host App can inspect a failure beyond its message. Mixed into both rather than promoted to a shared superclass because SandboxError and ServiceError sit in distinct branches of the invocation-outcome taxonomy under Kobako::Error.

Data specific to one kind of failure rides a named reader on the subclass that failure raises, the way Ruby pairs NameError#name with NameError#local_variables — see UndefinedEntrypointError.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#backtrace_linesArray[String]? (readonly)

Returns the value of attribute backtrace_lines.

Returns:

  • (Array[String], nil)


98
99
100
# File 'lib/kobako/errors.rb', line 98

def backtrace_lines
  @backtrace_lines
end

#klassString? (readonly)

Returns the value of attribute klass.

Returns:

  • (String, nil)


98
99
100
# File 'lib/kobako/errors.rb', line 98

def klass
  @klass
end

#originString? (readonly)

Returns the value of attribute origin.

Returns:

  • (String, nil)


98
99
100
# File 'lib/kobako/errors.rb', line 98

def origin
  @origin
end

Instance Method Details

#initialize(message, origin: nil, klass: nil, backtrace_lines: nil) ⇒ Object



100
101
102
103
104
105
# File 'lib/kobako/errors.rb', line 100

def initialize(message, origin: nil, klass: nil, backtrace_lines: nil)
  super(message)
  @origin = origin
  @klass = klass
  @backtrace_lines = backtrace_lines
end