← Server functions

Server.Error

luastra/server

Server.Error 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/server to this module's dependencies in luastra.json, then import it with require("luastra/server"). Declare rpc.call in luastra.json and configure a declared backend operation with a deployed trusted handler. Application code should prefer its generated operation function and decoder.

How it fits

The type describes request options, v2 limits, nullable values, public errors, or the tagged envelope-decoding result.

When to use it

Use Server.Error 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

ParameterType / valuesDescription
codestringStable machine-readable failure code suitable for branching and diagnostics.
messagestringBounded human-readable diagnostic that must not be parsed for control flow.
fields{ [string]: string }?Validated bounded field map carried by the decoded or migrated value.

SDK type flow

Produced by

Server.decodeError

What happens next

A checked request, result, limit, nullable-value, or public-error annotation.

Failures and fixes

Handle transport failure, envelope decode failure, and domain validation failure separately. The static web build does not deploy trusted backend handlers, credentials, or production operations for you.

Availability

Public-source alpha API in 0.5.0-alpha; production backend deployment remains application-owned.

Exact declaration

export type Error = { code: string, message: string, fields: { [string]: string }? }

Continue learning

Next steps

Server.decodeError

Complete inventory

View all pages in Server functions
← Previous: Server.NullableNext: Server.call →