fix: report missing input files without stack traces#1036
Open
He-Pin wants to merge 1 commit into
Open
Conversation
5cd11b6 to
a23a523
Compare
Motivation: Missing input files, binding files, and malformed paths could escape CLI error handling and print Java exception details or stack traces. Modification: Wrap input loading and binding parsing in clean Either-returning error handling, including missing files, IO failures, and malformed path IllegalArgumentException. Add JVM CLI regression tests for missing input files and malformed binding file paths. Result: The CLI now reports concise Opening ... errors for these paths, and regression tests verify the errors do not leak Java exception class names.
4e8555a to
56bc273
Compare
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.
Motivation
Missing CLI input files and binding files could leak raw Java exceptions or stack traces instead of clean user-facing errors. Malformed paths could also escape the normal error path.
NoSuchFileExceptionstack traceOpening input file: missing.jsonnet: no such file or directoryOpening binding file: missing.jsonnet: no such file or directoryInvalidPathException/IllegalArgumentExceptiondetailOpening binding file: <message>Modification
mainConfigured.parseBindingscalls for ext-vars and TLAs.NoSuchFileException,IOException, and malformed-pathIllegalArgumentExceptionin the relevant error paths.Result
--execpaths are unchanged.Verification
./mill --no-daemon 'sjsonnet.jvm[3.3.8].test' sjsonnet.MainTests./mill --no-daemon 'sjsonnet.jvm[3.3.8].checkFormat'