Repository navigation
Format Rust StatusError payloads via StatusPayloadPrinter with ByteStr-style escaping and a 512-byte limit. - #2261
Draft
copybara-service[bot] wants to merge 1 commit into
Draft
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
…yteStr`-style escaping and a 512-byte limit.
Previously, `StatusError` `Display`/`Debug` output rendered non-UTF-8 payloads with `{bytes:02x?}`, turning binary proto payloads such as `util.MessageSetPayload` into long bracketed hex lists (`[0b, 10, 86, ...]`) of unbounded size, and ignored any registered C++ `absl::status_internal::StatusPayloadPrinter`.
Now each payload is:
1. Formatted by the registered C++ `StatusPayloadPrinter` when it recognizes the payload, matching C++ `StatusRep::ToString()`.
2. Otherwise escaped like `Debug` for `ByteStr`: printable ASCII and valid UTF-8 pass through, while control characters and invalid UTF-8 are escaped (`\n`, `\xff`, ...).
3. Truncated to 512 bytes, followed by `...`.
PiperOrigin-RevId: 1002724673
copybara-service
Bot
force-pushed
the
test_1002724673
branch
from
October 20, 2026 02:00
bd253c8 to
d03a8ed
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.
Format Rust
StatusErrorpayloads viaStatusPayloadPrinterwithByteStr-style escaping and a 512-byte limit.Previously,
StatusErrorDisplay/Debugoutput rendered non-UTF-8 payloads with{bytes:02x?}, turning binary proto payloads such asutil.MessageSetPayloadinto long bracketed hex lists ([0b, 10, 86, ...]) of unbounded size, and ignored any registered C++absl::status_internal::StatusPayloadPrinter.Now each payload is:
StatusPayloadPrinterwhen it recognizes the payload, matching C++StatusRep::ToString().DebugforByteStr: printable ASCII and valid UTF-8 pass through, while control characters and invalid UTF-8 are escaped (\n,\xff, ...).....