Media.DecodeFailure
luastra/mediaMedia.DecodeFailure represents the unsuccessful branch of a bounded operation. Its stable code and structured context support control flow and safe diagnostics without parsing an exception message.
Before you use it
Add luastra/media to this module's dependencies in luastra.json, then import it with require("luastra/media"). Declare media.command in luastra.json. Set an admitted queue before playback, start playback from an explicit user action where required, and implement both app.resolve and media_state handling.
How it fits
The type describes queue input, live playback state, or the tagged state-decoding result.
When to use it
Use Media.DecodeFailure on the unsuccessful branch of the related result. Read its stable fields for control flow or diagnostics; do not parse human-readable assertion or error text.
Fields or definition
| Parameter | Type / values | Description |
|---|---|---|
| success | false | Discriminator that must be checked before reading branch-specific fields. |
| state | nil | Validated typed media state available on the successful decode branch. |
| error | string | Bounded failure information, or nil on the successful branch. |
Error codes
This is the complete closed vocabulary emitted by the named operation in this Source SDK contract.
| Code | When it occurs |
|---|---|
| invalid_wire | The media-state wire payload cannot be decoded. |
| missing_field | A required media-state field is absent. |
| invalid_state | The field set, status, or background flag is invalid. |
| invalid_number | A required numeric field is not a valid number. |
| invalid_error | The host error code and message fields are inconsistent. |
SDK type flow
Produced by
What happens next
A checked media input/state/result annotation.
Failures and fixes
Missing capability, absent queue, invalid asset/content URI, autoplay policy, interruption, unsupported background behavior, or host failure must remain visible state. Do not optimistically treat command acknowledgement as playback success.
Availability
Public-source alpha API in 0.5.0-alpha; background playback and system controls require target-specific verification.
Exact declaration
export type DecodeFailure = { success: false, state: nil, error: string }