Repository navigation
runtime: return false from include() when the file fails, instead of rethrowing - #94
Merged
Merged
Conversation
Owner
Author
|
Can we put this behind compatibility flag. Default to on, feels like a silent failure is a sad behaviour |
…rethrowing An include that failed to compile or threw was reported and then rethrown into the caller. d2bs reports the error, clears it and returns false, and scripts are written around that return value. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…urnsFalse flag The flag is on by default, so a failing include reports the error and returns false, as d2bs did. A script that wants failures to surface turns it off with Compatibility.set and gets the error rethrown into the caller. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ResurrectedTrader
force-pushed
the
runtime-include-returns-false
branch
from
October 8, 2026 10:54
93405a7 to
6763e5f
Compare
Owner
Author
|
Done: the behaviour is now the |
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.
d2bs behaviour
Script::Include(Script.cpp) compiles and executes the file. When either step fails it callsJS_ReportPendingException, which reports the error and clears it, and returns false.my_include(JSCore.cpp) hands that bool back to the script. A failing include never throws into the caller.d2bsng before
Script::Includereported the exception, then calledtryCatch.ReThrow()in both the compile-failure and the run-failure paths. The error went up into the calling script, andinclude()threw instead of returning false.Fix
Drop both
ReThrow()calls. The error is still reported throughReportException, which includes the QuitOnError handling, andinclude()returns false, as in d2bs. The binding's@returnsdoc now says so.kolbot usage restored
libs/core/Loader.jsloads each configured script withif (!include("scripts/" + script + ".js")) { Misc.errorReport(...); continue; }. With the rethrow, one broken script file threw out of the loader loop and ended the run. Now it is reported and skipped.Not live-tested. It builds, and the unit tests and the format check pass.
🤖 Generated with Claude Code