Skip to content

Add error toast (red background, 3× duration) for copy command failures#927

Merged
SorraTheOrc merged 2 commits intomainfrom
copilot/add-error-toast-feature
Mar 12, 2026
Merged

Add error toast (red background, 3× duration) for copy command failures#927
SorraTheOrc merged 2 commits intomainfrom
copilot/add-error-toast-feature

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 12, 2026

Copy failures (e.g. xclip not installed) were visually indistinguishable from successes — both used the same green toast. Error conditions now render a distinct red toast that stays visible 3× longer.

Changes

  • ToastComponent — adds showError(message) method; extracts shared display logic into _showWithOptions() which handles per-call background override and restoration after hide
  • controller.ts — adds showErrorToast() alongside showToast(); copySelectedId() now routes all failure paths through showErrorToast() instead of showToast()
  • test-utils.ts — mock toast and toastComponent expose showError() and lastIsError() for test assertions
  • copy-id.test.ts — asserts lastIsError() === false on success and === true when a failure message is produced
// Success: green toast, 1200 ms
if (res.success) showToast('ID copied');
// Failure: red toast, 3600 ms
else showErrorToast(res.error ? `Copy failed: ${res.error}` : 'Copy failed');
Original prompt

This section details on the original issue you should resolve

<issue_title>Error toasts</issue_title>
<issue_description>

Add an error toast that can be used when the system encounters an error. This should be like the current toasts only it should have a red background and should be visible for 3x as long. The first place this would be used would be for the copy command (C) in the TUI. If xclip is not installed this currently issues a toast that is an error, but it is indistinguishable to a success toast.</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: SorraTheOrc <250240+SorraTheOrc@users.noreply.github.com>
Copilot AI changed the title [WIP] Add error toast for system errors Add error toast (red background, 3× duration) for copy command failures Mar 12, 2026
@SorraTheOrc SorraTheOrc marked this pull request as ready for review March 12, 2026 10:14
@SorraTheOrc SorraTheOrc merged commit 6c768fb into main Mar 12, 2026
@SorraTheOrc SorraTheOrc deleted the copilot/add-error-toast-feature branch March 12, 2026 10:14
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.

Clear GitHub sync mappings

2 participants