fix(frontend): decode blob error bodies so tools show the server's reason - #7619
Draft
posthog-eu[bot] wants to merge 1 commit into
Draft
fix(frontend): decode blob error bodies so tools show the server's reason#7619posthog-eu[bot] wants to merge 1 commit into
posthog-eu[bot] wants to merge 1 commit into
Conversation
Tool POSTs use responseType "blob", so error.response.data reaches
handleHttpError as an unread Blob. The toast message was built from that raw
Blob before the blob was decoded, so JSON.stringify(Blob) returned "{}", the
message was rejected as unhelpful, and every server error fell back to the
generic "There was an error processing your request." text.
Decode the response body once, up front, and pass the decoded body into
extractAxiosErrorMessage. The server explanation now reaches the toast for
every tool that posts with responseType blob, which also makes the merge 500
diagnosable.
Generated-By: PostHog Desktop
Task-Id: 1544e247-e89a-478f-8b54-6fce70390e6a
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.
Description of Changes
Why
/mergeare the one measurable proxy, and none of these failures reach error tracking.What changed
handleHttpErrorbuilt the toast fromerror.response.databefore the Blob was decoded. Every tool POST setsresponseType: "blob", so at that point the body was an unread Blob:JSON.stringify(Blob)returns"{}", the message was rejected as unhelpful, and it fell back to the generic text — the decoded server explanation was then never used for the toast.extractAxiosErrorMessage.extractAxiosErrorMessagenow takes an optional decoded-body argument and prefers it over the rawerror.response.data.Impact
responseType: "blob", not merge alone.Tests
httpErrorHandler.test.ts: a blob error body (JSON and plain text) now surfaces the server message in the toast instead of the generic fallback.Checklist
General
Documentation
Translations (if applicable)
scripts/counter_translation.pyUI Changes (if applicable)
Testing (if applicable)
task checkto verify linters, typechecks, and tests passCreated with PostHog Desktop from this inbox report.