From 820385b82b58edb8874e4a375b869052f0af98ed Mon Sep 17 00:00:00 2001 From: Jamie Wells Date: Wed, 28 Oct 2026 05:07:07 +0000 Subject: [PATCH] Document JavaScript engine query error diagnostics --- .../sandbox-values-and-diagnostics.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/Scripting/scriptingJavaScript/sandbox-values-and-diagnostics.md b/docs/Scripting/scriptingJavaScript/sandbox-values-and-diagnostics.md index ca839a5..41d5d9d 100644 --- a/docs/Scripting/scriptingJavaScript/sandbox-values-and-diagnostics.md +++ b/docs/Scripting/scriptingJavaScript/sandbox-values-and-diagnostics.md @@ -11,6 +11,15 @@ Use the engine-owned `Timer` facade for delayed/repeating gameplay callbacks. Sc objects are frozen; do not attempt to modify them. Values crossing the bridge are JSON-compatible representations of the shared engine types. A callback exception or instruction-budget failure disables that behavior, while other scripts continue. + +Engine query failures throw a JavaScript `Error` whose `message` contains the +engine's rejection reason. During Play, use `try/catch` around an optional query +and log `error.message` (or `error.stack`) to diagnose missing objects, invalid +arguments, or unavailable host features. An uncaught exception in source loading +or a lifecycle callback retains its message and available stack in the runtime +error log. A caught query error lets the behavior continue; an uncaught callback +error disables that behavior. + Generated type declarations are at `.rustic/generated/programming/rustic_api.d.ts`; generated files may be regenerated, so never put game logic there.