-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat: improve error display with collapsible UI and contextual titles #7401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9d3c026
feat: improve error display with collapsible UI and contextual titles
hannesrudolph 446bafb
fix: resolve failing tests and add missing translations
hannesrudolph 44e4fee
refactor: address code review feedback for error display
hannesrudolph a0d37f9
fix: correct i18n key format and remove dead error icon/title code
hannesrudolph 3ff0823
fix: convert inline styles to Tailwind classes and expand i18n error …
hannesrudolph b9ccbe5
fix: add missing error translations to all locales
hannesrudolph fb0296c
chore: remove accidentally committed temp files
hannesrudolph 12d07db
staged changes after revert to 4517eb7
hannesrudolph 7d006ba
chore(i18n): sentence case error titles ('File not found', 'File alre…
hannesrudolph 04db47b
chore(i18n): sentence case for error titles (tool and generic); align…
hannesrudolph bacedd6
chore(i18n): add missing en/tools keys (executeCommand, fetchInstruct…
hannesrudolph 72c79ce
chore(i18n): use t() for tool messages; add generic noChanges/changes…
hannesrudolph e2592f0
test(i18n): align en/tools messages with tests (noChanges includes pa…
hannesrudolph 87b777a
fix(i18n): parameterized noChanges; title-case error titles; update t…
hannesrudolph 9b0cdcd
fix(i18n): unify keys at tools root; use t('tools:noChanges'|'tools:c…
hannesrudolph d900b77
test: align insertContentTool error title with spec
hannesrudolph 1734b67
fix: align error strings with unit tests (insertContent/attemptComple…
hannesrudolph b5a93fe
test(webview-ui): wrap ChatRow tests with QueryClientProvider to fix …
hannesrudolph 3c60c6e
fix(prompts): title-case tool error headers and align en i18n keys to…
hannesrudolph d938fb6
fix(list-files): surface top-level symlinked files in non-recursive m…
hannesrudolph b20c4d8
fix(list-files): always pass --follow to ripgrep and include top-leve…
hannesrudolph File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import { describe, it, expect } from "vitest" | ||
| import { formatResponse } from "../responses" | ||
|
|
||
| describe("formatResponse.toolError", () => { | ||
| it("should format error without tool name when not provided", () => { | ||
| const error = "Something went wrong" | ||
| const result = formatResponse.toolError(error) | ||
|
|
||
| expect(result).toBe("Tool Execution Error\n<error>\nSomething went wrong\n</error>") | ||
| }) | ||
|
|
||
| it("should format error with tool name when provided", () => { | ||
| const error = "Invalid mode: test_mode" | ||
| const toolName = "switch_mode" | ||
| const result = formatResponse.toolError(error, toolName) | ||
|
|
||
| expect(result).toBe("Tool Call Error: switch_mode\n<error>\nInvalid mode: test_mode\n</error>") | ||
| }) | ||
|
|
||
| it("should handle undefined error message", () => { | ||
| const result = formatResponse.toolError(undefined, "new_task") | ||
|
|
||
| expect(result).toBe("Tool Call Error: new_task\n<error>\nundefined\n</error>") | ||
| }) | ||
|
|
||
| it("should work with various tool names", () => { | ||
| const testCases = [ | ||
| { toolName: "write_to_file", expected: "Tool Call Error: write_to_file" }, | ||
| { toolName: "execute_command", expected: "Tool Call Error: execute_command" }, | ||
| { toolName: "apply_diff", expected: "Tool Call Error: apply_diff" }, | ||
| { toolName: "new_task", expected: "Tool Call Error: new_task" }, | ||
| { toolName: "use_mcp_tool", expected: "Tool Call Error: use_mcp_tool" }, | ||
| ] | ||
|
|
||
| testCases.forEach(({ toolName, expected }) => { | ||
| const result = formatResponse.toolError("Test error", toolName) | ||
| expect(result).toContain(expected) | ||
| }) | ||
| }) | ||
|
|
||
| it("should maintain backward compatibility when tool name is not provided", () => { | ||
| // This ensures existing code that doesn't pass toolName still works | ||
| const error = "Legacy error" | ||
| const result = formatResponse.toolError(error) | ||
|
|
||
| // Should not contain "Tool Call Error:" prefix | ||
| expect(result).not.toContain("Tool Call Error:") | ||
| // Should contain generic title | ||
| expect(result).toContain("Tool Execution Error") | ||
| }) | ||
| }) |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.