fix(protoapp): propagate binding errors to plugins via lastError API#25
Merged
pabloinigoblasco merged 1 commit intoApr 2, 2026
Merged
Conversation
When ensureParserBinding() fails, plugins need to know WHY it failed to show meaningful error messages to users. The SDK already provides the lastError() API for this purpose, but the protoapp implementation always returned nullptr. Problem: - rhGetLastError() returned nullptr unconditionally - Plugins received empty error strings: "/topic (encoding: ros1): " - Users couldn't distinguish between "parser not installed" vs "schema corrupted" vs "internal parser error" Solution: - Add last_error field to RuntimeHostState - Store descriptive error message at each failure point in rhEnsureParserBinding (5 failure points total) - Return stored error from rhGetLastError() Now plugins show actionable messages: "/topic (encoding: ros1): no parser found for encoding 'ros1'" "/bad (encoding: cdr): failed to parse schema: Missing ROSType" This enables MCAP, Foxglove Bridge, and PJ Bridge plugins to report binding failures with context, helping users diagnose missing parsers or malformed schemas. No SDK changes required - this implements the existing lastError() contract that the protoapp was not fulfilling.
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.
Summary
When
ensureParserBinding()fails, plugins need to know why it failed to show meaningful error messages. The SDK provides thelastError()API for this purpose, but the protoapp implementation always returnednullptr.Before this fix
Plugins received empty error strings:
Users couldn't distinguish between:
After this fix
Plugins show actionable messages:
Technical details
The SDK uses a C ABI for plugin ↔ host communication. When
ensure_parser_binding()returnsfalse, the SDK wrapper callsget_last_error()to populate theExpected<Handle>error message. This contract was already designed correctly — the bug was thatrhGetLastError()always returnednullptr.Changes
data_source_session.hppstd::string last_errortoRuntimeHostStatedata_source_session.cppdata_source_session.cppstate->last_errorfromrhGetLastError()Failure points now covered
Impact
Enables MCAP, Foxglove Bridge, and PJ Bridge plugins to report binding failures with context. No SDK changes required.
Test plan