Module: Kobako::Outcome
- Defined in:
- lib/kobako/outcome.rb,
sig/kobako/outcome.rbs
Overview
Host-facing boundary for the invocation outcome the native side split off the core envelope. Takes the arm it named plus the fields that arm carries, and settles the invocation the way a host does: return the value, or raise the exception the failure attributes to.
This is the two-step attribution decision. The wire framing belongs to
the native side; the payload codec at Kobako::Codec decodes only
the one arm that carries a value.
Constant Summary collapse
- ORIGIN_SANDBOX =
The two
originvalues a Panic attributes with. "sandbox"- ORIGIN_SERVICE =
"service"- SUBCLASSES =
The guest-written class names that select a
SandboxErrorsubclass. A name absent here settles as plainSandboxError, so the guest widens the taxonomy only by naming a class the host already defines. { "Kobako::BytecodeError" => BytecodeError, "Kobako::UndefinedEntrypointError" => UndefinedEntrypointError }.freeze
Class Method Summary collapse
-
.reify(kind, payload, panic, entrypoint: nil) ⇒ Object
Settle one invocation.
Instance Method Summary collapse
- #self?.decode_value ⇒ Kobako::Codec::wire_value
- #self?.error_class ⇒ singleton(SandboxError), singleton(ServiceError)
-
#self?.panic_error ⇒ SandboxError, ServiceError
Everything below is private_class_method at runtime; RBS cannot mark a
self?method private, so the declarations stay visible to the checker. - #self?.reify ⇒ Kobako::Codec::wire_value
- #self?.trap_error ⇒ TrapError
- #self?.wire_error ⇒ Transport::Error
Class Method Details
.reify(kind, payload, panic, entrypoint: nil) ⇒ Object
Settle one invocation. kind names the arm, payload is the
codec-encoded value the :ok arm carries, and panic carries
the Panic's fields [origin, class, message, backtrace, available] —
present on the panic arm and absent on every other, which is what
tells the failure that has a record to attribute from apart from the
two that do not. entrypoint is the name this invocation asked for,
which the host knows and the wire therefore never carries.
37 38 39 40 41 |
# File 'lib/kobako/outcome.rb', line 37 def reify(kind, payload, panic, entrypoint: nil) return decode_value(payload) if kind == :ok raise panic ? panic_error(panic, entrypoint) : trap_error(kind) end |
Instance Method Details
#self?.decode_value ⇒ Kobako::Codec::wire_value
19 |
# File 'sig/kobako/outcome.rbs', line 19
def self?.decode_value: (String payload) -> Kobako::Codec::wire_value
|
#self?.error_class ⇒ singleton(SandboxError), singleton(ServiceError)
15 |
# File 'sig/kobako/outcome.rbs', line 15
def self?.error_class: (String origin, String klass) -> (singleton(SandboxError) | singleton(ServiceError))
|
#self?.panic_error ⇒ SandboxError, ServiceError
Everything below is private_class_method at runtime; RBS cannot mark a
self? method private, so the declarations stay visible to the checker.
13 |
# File 'sig/kobako/outcome.rbs', line 13
def self?.panic_error: (panic_fields panic, Symbol? entrypoint) -> (SandboxError | ServiceError)
|
#self?.reify ⇒ Kobako::Codec::wire_value
9 |
# File 'sig/kobako/outcome.rbs', line 9
def self?.reify: (Symbol kind, String payload, panic_fields? panic, ?entrypoint: Symbol?) -> Kobako::Codec::wire_value
|
#self?.trap_error ⇒ TrapError
17 |
# File 'sig/kobako/outcome.rbs', line 17
def self?.trap_error: (Symbol kind) -> TrapError
|
#self?.wire_error ⇒ Transport::Error
21 |
# File 'sig/kobako/outcome.rbs', line 21
def self?.wire_error: (String message, ?diagnostic: String?) -> Transport::Error
|