Module: Plushie::Event::Diagnostic
- Defined in:
- lib/plushie/event/diagnostic.rb,
sig/plushie/event.rbs
Overview
Typed diagnostic variants emitted via the renderer's diagnostic channel. Each constant is a Data class; Diagnostic.decode parses a wire payload into the matching variant.
Constant Summary collapse
- KINDS =
The kind discriminator -> Data class mapping. Ordered to match the renderer's plushie-core::Diagnostic enum.
{}
- DuplicateId =
- EmptyId =
- MultipleTopLevelWindows =
- UnknownWindow =
- UnrecognizedWidgetPlaceholder =
- TreeDepthExceeded =
- TooManyDuplicates =
- WidgetIdInvalid =
- MissingAccessibleName =
- A11yRefUnresolved =
- PropRangeExceeded =
- PropTypeMismatch =
- PropUnknown =
- ContentLengthExceeded =
- FontCacheCapExceeded =
- FontCapExceeded =
- FontFamilyNotFound =
- InvalidSettings =
- RequiredWidgetsMissing =
- WidgetPanic =
- SvgParseError =
- SvgDecodeTimeout =
- DashCacheCapExceeded =
- EmitterCoalesceCapExceeded =
- WidgetIdTypeCollision =
- ViewPanicked =
- UpdatePanicked =
- UnknownMessageType =
- DispatchLoopExceeded =
- BufferOverflow =
Class Method Summary collapse
-
.decode(payload) ⇒ Object
Build a typed Diagnostic from a raw wire payload (
{"kind": ...}plus variant-specific fields).
Class Method Details
.decode(payload) ⇒ Object
Build a typed Diagnostic from a raw wire payload ({"kind": ...}
plus variant-specific fields).
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/plushie/event/diagnostic.rb', line 178 def decode(payload) raise ArgumentError, "diagnostic payload must be a Hash, got #{payload.inspect}" unless payload.is_a?(Hash) kind = payload["kind"] klass = KINDS[kind] unless klass raise ArgumentError, "Unknown diagnostic kind #{kind.inspect}. The renderer emitted a " \ "diagnostic this SDK version does not recognize. Ensure the SDK and " \ "renderer versions are compatible." end members = klass.members attrs = {} #: Hash[Symbol, untyped] members.each do |m| attrs[m] = payload[m.to_s] end klass.new(**attrs) end |