Class: Kobako::Outcome::Panic
- Inherits:
-
Object
- Object
- Kobako::Outcome::Panic
- Defined in:
- lib/kobako/outcome/panic.rb,
sig/kobako/outcome/panic.rbs
Overview
Wire-contract Outcome Envelope → Panic envelope (docs/wire-contract.md Outcome Envelope). Wire-shaped failure record carried in the OUTCOME_BUFFER when the guest run terminates with an uncaught top-level exception.
This is the wire data, not a raisable Ruby exception. The
mapping from Panic to a three-layer Ruby exception (TrapError /
SandboxError / ServiceError) happens at Kobako::Outcome.decode
via build_panic_error — callers never raise Panic directly.
The five fields mirror SPEC: origin ("sandbox" / "service"),
klass (the guest-side exception class name as a String),
message, backtrace (Array of String), details (any
wire-legal value, nil when absent). Required-field validation is
enforced at construction; the ORIGIN_SANDBOX / ORIGIN_SERVICE
constants pin the two SPEC-defined origin values.
Built on the class X < Data.define(...) subclass form so the
class body is fully Steep-visible; ruby/rbs upstream documents
this as the Steep-friendly shape and the Style/DataInheritance
cop is disabled on that basis (see .rubocop.yml).
Constant Summary collapse
- ORIGIN_SANDBOX =
"sandbox"- ORIGIN_SERVICE =
"service"
Instance Attribute Summary collapse
-
#backtrace ⇒ Array[String]
readonly
Returns the value of attribute backtrace.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#klass ⇒ String
readonly
Returns the value of attribute klass.
-
#message ⇒ String
readonly
Returns the value of attribute message.
-
#origin ⇒ String
readonly
Returns the value of attribute origin.
Instance Method Summary collapse
- #== ⇒ Boolean
- #hash ⇒ Integer
-
#initialize(origin:, klass:, message:, backtrace: [], details: nil) ⇒ Panic
constructor
A new instance of Panic.
- #with ⇒ Object
Constructor Details
#initialize(origin:, klass:, message:, backtrace: [], details: nil) ⇒ Panic
Returns a new instance of Panic.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/kobako/outcome/panic.rb', line 30 def initialize(origin:, klass:, message:, backtrace: [], details: nil) raise ArgumentError, "Panic origin must be String" unless origin.is_a?(String) raise ArgumentError, "Panic class must be String" unless klass.is_a?(String) raise ArgumentError, "Panic message must be String" unless .is_a?(String) unless backtrace.is_a?(Array) && backtrace.all?(String) raise ArgumentError, "Panic backtrace must be Array of String" end super end |
Instance Attribute Details
#backtrace ⇒ Array[String] (readonly)
Returns the value of attribute backtrace.
10 11 12 |
# File 'sig/kobako/outcome/panic.rbs', line 10 def backtrace @backtrace end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
11 12 13 |
# File 'sig/kobako/outcome/panic.rbs', line 11 def details @details end |
#klass ⇒ String (readonly)
Returns the value of attribute klass.
8 9 10 |
# File 'sig/kobako/outcome/panic.rbs', line 8 def klass @klass end |
#message ⇒ String (readonly)
Returns the value of attribute message.
9 10 11 |
# File 'sig/kobako/outcome/panic.rbs', line 9 def @message end |
#origin ⇒ String (readonly)
Returns the value of attribute origin.
7 8 9 |
# File 'sig/kobako/outcome/panic.rbs', line 7 def origin @origin end |
Instance Method Details
#== ⇒ Boolean
29 |
# File 'sig/kobako/outcome/panic.rbs', line 29
def ==: (untyped other) -> bool
|
#hash ⇒ Integer
31 |
# File 'sig/kobako/outcome/panic.rbs', line 31
def hash: () -> Integer
|
#with ⇒ Object
21 |
# File 'sig/kobako/outcome/panic.rbs', line 21
def with: (
|