Skip to content

fix: include stderr content in runNativePlugin exception#72

Merged
andreaTP merged 2 commits intoroastedroot:mainfrom
ai-pipestream:fix/include-stderr-in-plugin-exceptions
Apr 29, 2026
Merged

fix: include stderr content in runNativePlugin exception#72
andreaTP merged 2 commits intoroastedroot:mainfrom
ai-pipestream:fix/include-stderr-in-plugin-exceptions

Conversation

@krickert
Copy link
Copy Markdown
Contributor

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

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.
Copy link
Copy Markdown
Contributor

@andreaTP andreaTP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).
@andreaTP
Copy link
Copy Markdown
Contributor

Thanks for making the changes @krickert !

@andreaTP andreaTP merged commit 369c53e into roastedroot:main Apr 29, 2026
13 checks passed
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants