Skip to content

feat(notifications): inspectable error toasts with details dialog#3247

Merged
charlesvien merged 7 commits into
mainfrom
posthog-code/error-toast-details-dialog
Jul 8, 2026
Merged

feat(notifications): inspectable error toasts with details dialog#3247
charlesvien merged 7 commits into
mainfrom
posthog-code/error-toast-details-dialog

Conversation

@adamleithp

@adamleithp adamleithp commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Problem

Error notifications routed through the notification bus dump the raw JSON error into the toast. The payload overflows the toast and there's no way to inspect it.

2026-07-07 23 15 38

Changes

  • Error toasts now show a one-line summary with a Details action instead of the raw payload. New NotificationBus.notifyError(title, error, target?) producer and an error field on NotificationDescriptor.
  • The Details action opens a global quill dialog with the error pretty-printed (safe serialization: Error instances expand with stack and enumerable extras, circular refs elided) in a CodeBlock with copy support.
  • Download error + logs button bundles the error with recent renderer logs into a markdown file. Logs come from a new in-memory ring buffer (shell/logCapture.ts) teed off the shell logger, so no host changes are needed.
  • In dev builds, a Create task from error button prefills the new-task composer with the error and recent logs as context via the existing openTaskInput prefill path. It sits on the left of the dialog footer and carries a Dev badge to mark it dev-only.
  • Toast descriptions no longer overflow: a long, unbroken JSON error string (no spaces to wrap at) previously blew past the fixed 360px toast card because quill's .quill-toast-card__description sets no overflow-wrap. Now it breaks anywhere and clamps to 3 lines — the toast is just a summary; the full payload lives behind Details.

How did you test this?

  • pnpm --filter @posthog/ui exec vitest run src/features/notifications src/shell — 103 tests pass, including new suites for notifyError routing and the error serialization/summarization helpers.
  • pnpm --filter @posthog/ui typecheck and Biome check on touched files — clean.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

Error-level notifications no longer dump raw JSON into the toast. The
toast shows a one-line summary with a "Details" action that opens a
quill dialog: pretty-printed error payload, a downloadable
error-plus-logs bundle (fed by a new renderer log ring buffer teed off
the shell logger), and a dev-only shortcut that prefills a new task
with the error and recent logs as context.

Generated-By: PostHog Code
Task-Id: 8fd812ea-6ddb-4811-bb8a-cf00dbad7ea1
@trunk-io

trunk-io Bot commented Jul 7, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit fd75b61.

…rror

The click-to-inspect Details action only reached errors sent through
NotificationBus, but the toasts that actually dump raw JSON are direct
toast.error calls in hooks. Add a lightweight toastError helper (summary
in the toast, full pretty-printed payload behind a Details action) and
migrate every raw-error dump to it. serializeError now reflows the JSON
embedded in API error strings so the dialog is readable.

Generated-By: PostHog Code
Task-Id: 8fd812ea-6ddb-4811-bb8a-cf00dbad7ea1
@charlesvien charlesvien marked this pull request as ready for review July 7, 2026 22:37
@greptile-apps

greptile-apps Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(notifications): route raw-error toas..." | Re-trigger Greptile

Comment thread packages/ui/src/features/notifications/notifications.ts
Comment thread packages/ui/src/features/notifications/ErrorDetailsDialog.tsx
Comment thread packages/ui/src/features/notifications/errorDetails.test.ts
adamleithp and others added 5 commits July 7, 2026 23:52
…ialog footer

Long unbroken JSON error strings overflowed the fixed 360px toast card
(Quill's description class sets no overflow-wrap). Break anywhere and
clamp to 3 lines. Move the dev-only create-task button to the left of
the dialog footer and tag it with a "Dev" badge.

Generated-By: PostHog Code
Task-Id: 025dc6c9-832e-43f0-b7dd-ea06a7ee43c9
Compute the error summary once in notifyError, and drop the json fence
on the create-task error block (serializeError may return a plain string).

Generated-By: PostHog Code
Task-Id: 025dc6c9-832e-43f0-b7dd-ea06a7ee43c9
@charlesvien charlesvien merged commit 3c1598c into main Jul 8, 2026
26 checks passed
@charlesvien charlesvien deleted the posthog-code/error-toast-details-dialog branch July 8, 2026 03:34
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