Repository navigation
rune-luau: Script::try_render_fn returns a render's Result instead of the error card (#420) - #2168
Merged
Merged
Conversation
… the error card (#420)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This covers only the last point of #420: a host choosing what appears when a script fails, in place of the debug card. It doesn't touch history-dependent presentation, live rotation, the Luau wall clock or pipeline prewarming.
Change
rune_luau::Script::try_render_fn(dark, f, args) -> Result<El, ScriptError>. It rendersf(view, args...)once, outside any memo, and returns the error instead of drawing the error card, so a host can keep its last good tree on screen or draw its own fallback. A script that failed to start or stopped returns its stored error (Script::error), orErrorKind::Missingif it has none.Inner::render_withmoved intotry_render_with, andrender_withnow only turns anErrinto the error card.render_fnshould behave the same: same render metrics, same error logging, same memo-salt bump on failure, same card messages.rune-luauREADME table and added a changelog file.Tests (
crates/rune-luau/src/functions_tests.rs)try_render_fn_returns_element_or_error: a working function returnsOk, and a throwing one returnsErrwith its message and logs it.try_render_fn_returns_stored_failure: a script that fails at startup returns exactly its storedScript::error(), and no render runs.Not run: the environment that wrote this change had no Rust toolchain, so nothing has been compiled. Please run
cargo test -p rune-luau(needs a C++ compiler) andcargo check --workspace --all-targetsbefore merging.Closes #420