Repository navigation
ably: fix broken log format when presence history data fails to decode - #714
RaphaelFakhri wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. WalkthroughThe presence-message decode-error log now formats errors with ChangesPresence decode log
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk:
|
HTTPPresence history logged the decode failure with %w, which the logger's Printf-style formatting renders as %!w(...). Use %v, as the message decoders in http_channel.go do.
41b41cc to
a9b4a12
Compare
|
Rebased onto |
Description
When
RESTChannel.Presence.Historyreceives a presence message whose data can't be decoded (for example, an unknownencoding), the SDK logs the failure with%w. The logger formats messages withfmt.Sprintf, which doesn't support%w, so the log line ends with%!w(*errors.errorString=&{unknown encoding nonsense})instead of the error text.This change uses
%v, which matches the equivalent messages inrest_channel.go.Testing
Adds
TestRESTPresence_HistoryLogsDecodeFailure. It serves a presence history page with an unknownencodingfrom a local HTTP server, records the log output throughWithLogHandler, and asserts that the decode failure is logged without a formatting error and includes the error text.Without the fix, the test fails with a log line that contains
%!w(. With the fix, it passes.Summary by CodeRabbit