Navigation.RouteError
luastra/navigationNavigation.RouteError 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/navigation to this module's dependencies in luastra.json, then import it with require("luastra/navigation"). No host capability is required for in-memory navigation. Browser URL/history synchronization additionally needs luastra/host and navigation.history.
How it fits
The type describes a route, stack, compiler, or checked result used by navigation operations.
When to use it
Use Navigation.RouteError 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 |
|---|---|---|
| code | string | Stable machine-readable failure code suitable for branching and diagnostics. |
Error codes
This is the complete closed vocabulary emitted by the named operation in this Source SDK contract.
| Code | When it occurs |
|---|---|
| invalid_location | The location is malformed, non-canonical, or exceeds route segment limits. |
| route_not_found | No compiled route definition matches the location. |
| invalid_entry | The typed route entry has an invalid shape or parameters. |
| unknown_route | The entry names a route absent from the compiler. |
| invalid_parameter | A required path parameter is missing or invalid. |
| missing_query | A required query parameter is absent. |
| invalid_query | A supplied query parameter cannot be decoded or validated. |
| location_too_large | The generated canonical location exceeds 2048 bytes. |
SDK type flow
Produced by
What happens next
A checked route/navigation annotation.
Failures and fixes
Invalid definitions, unknown routes, malformed parameters, excessive history depth, or incompatible snapshots return bounded errors or fail construction. Navigation result records use success:boolean with optional fields, so verify the field you need after checking success.
Availability
Public-source alpha API in 0.5.0-alpha; URL integration is a separate host capability.
Exact declaration
export type RouteError = { code: string }