You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lua.call_function/3 (and the {:error, reason, _} it returns) surfaces the full terminal-formatted error string as reason — ANSI escape codes, the at <source>:<line>: location header, the Suggestion: block, and stack-trace frames — rather than a terse message. Host code that protects a call and shows the reason to users gets a multi-line, ANSI-laced blob.
Same shape for index nil / call non-function (each also appends a Suggestion: section).
Why it's a problem
do_call_function/3 rescues the VM exception and returns Exception.message(e) as reason. For Lua.VM.RuntimeError/TypeError/AssertionError, Exception.message/1 runs ErrorFormatter.format/3 — the terminal renderer (location header, source pointer, stack trace, suggestion, ANSI when IO.ANSI.enabled?/0).
That's the right output for a CLI/REPL, but call_function's :error reason is a programmatic value. Consumers that catch it and re-surface it (logs, events, an error string handed back to Lua) now get:
ANSI escape codes embedded in stored/transmitted strings (when a TTY is attached),
multi-line location/suggestion/stack-trace noise where a one-line message is expected.
Downstream (sidecar): our host-side protected-call helper feeds reason into a workflow_fail_step event reason shown in the product UI. Pre-1.0 (luerl) this was Lua runtime error: boom; under rc.1 it's the blob above. PUC-Lua's own pcall returns just <source>:<line>: boom.
Proposed fix
Decouple the programmatic reason from the terminal render. call_function's :error reason should be the terse message (what pcall hands back — the §6.1 source:line:-prefixed value, available as RuntimeError.lua_value, or the raw raw_message), with no ANSI / suggestion / stack-trace. Keep ErrorFormatter.format/3 for Lua.RuntimeException's display message and Mix/CLI surfaces, but don't bake terminal formatting into the value returned from a programmatic call boundary.
Activity
fix(vm): return terse Lua error value from call_function, not termina…
fix(vm): return terse Lua error value from call_function, not termina…