fix: include stderr content in runNativePlugin exception#72
Merged
andreaTP merged 2 commits intoroastedroot:mainfrom Apr 29, 2026
Merged
Conversation
The caught RuntimeException was printing stdout/stderr to System.out/err but not attaching them to the thrown exception. Callers wrapping the exception lost protoc's diagnostic output. Now the exception message includes stderr inline and notes stdout byte count when non-empty. Raw stdout/stderr are still available at FINE log level for debugging.
andreaTP
approved these changes
Apr 28, 2026
Contributor
andreaTP
left a comment
There was a problem hiding this comment.
One nitpick but LGTM, thanks a lot again!
| LOGGER.log(Level.FINE, "protoc stderr: {0}", stderrContent); | ||
| } | ||
| String detail = "Error running protoc native plugin. stderr:\n" + stderrContent; | ||
| if (stdout.size() > 0) { |
Contributor
There was a problem hiding this comment.
I think we should check for stderr.size() too
Append stderr in runNativePlugin exception only when stderr.size() > 0. Brings in main updates (WASM input buffer, JUnit bump).
Contributor
|
Thanks for making the changes @krickert ! |
andreaTP
pushed a commit
that referenced
this pull request
Apr 30, 2026
The caught RuntimeException was printing stdout/stderr to System.out/err but not attaching them to the thrown exception. Callers wrapping the exception lost protoc's diagnostic output. Now the exception message includes stderr inline and notes stdout byte count when non-empty. Raw stdout/stderr are still available at FINE log level for debugging.
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.
The caught RuntimeException was printing stdout/stderr to System.out/err but not attaching them to the thrown exception. Callers wrapping the exception lost protoc's diagnostic output. This would allow upstream plugins to better react to errors found in the native plugin.
Now the exception message includes stderr inline and notes stdout byte count when non-empty. Raw stdout/stderr are still available at FINE log level for debugging.
Added a test to prove functionality. Keeps the console clean.
Also used string join instead of collectors - one less import and does the same thing