asobi_lua_game_error (asobi v0.72.6)

View Source

Emits the public [asobi, error] game-error telemetry for a failed Lua callback, and provides the bounded error-rendering helpers shared by the log and dev-error paths.

Only bounded, PII-free context crosses the telemetry boundary (which fans out to whatever handlers an operator attached): the callback name, the script basename (never a path), and a classified reason. The raw error reason - which can embed player input via Lua error()/assert() - is deliberately NOT included; callers that want a human-readable rendering use format_reason/1, which is length-capped for the same reason.

Summary

Functions

Cap a binary at the shared 500-char rendering budget; non-binaries become <<"<unprintable>">>.

Emit [asobi, error] for a failed Lua callback; only bounded, PII-free context crosses the boundary.

Human-readable, length-capped rendering of a callback error reason.

Classify a callback error reason for telemetry and logs.

Basename of a script path, <<"<unknown>">> for anything unexpected. Never a full path.

Functions

bound/1

-spec bound(term()) -> binary().

Cap a binary at the shared 500-char rendering budget; non-binaries become <<"<unprintable>">>.

emit(Callback, Reason, Script)

-spec emit(atom(), term(), term()) -> ok.

Emit [asobi, error] for a failed Lua callback; only bounded, PII-free context crosses the boundary.

format_reason/1

-spec format_reason(term()) -> binary().

Human-readable, length-capped rendering of a callback error reason.

The reason can embed player input (Lua error()/assert() values), so every rendering is bounded before it reaches a log line or a dev-mode client message - an attacker feeding oversized input into a failing callback must not get an unbounded write amplifier.

reason_class/1

-spec reason_class(term()) -> atom().

Classify a callback error reason for telemetry and logs.

script_basename/1

-spec script_basename(dynamic()) -> binary().

Basename of a script path, <<"<unknown>">> for anything unexpected. Never a full path.