Skip to content

Commit 5a2b9d3

Browse files
committed
fix test and remove unecessary keys in error
1 parent 5e936c2 commit 5a2b9d3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

frontend/src/core/ai/tools/__tests__/registry.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ describe("FrontendToolRegistry", () => {
5555
expect(typeof response.error).toBe("string");
5656

5757
// Verify error message contains expected prefix
58-
expect(response.error).toContain("Error invoking tool ToolExecutionError:");
59-
expect(response.error).toContain('"code":"TOOL_ERROR"');
60-
expect(response.error).toContain('"is_retryable":false');
58+
expect(response.error).toMatchInlineSnapshot(
59+
`"Error invoking tool ToolExecutionError: {"message":"Tool test_frontend_tool returned invalid input: ✖ Invalid input: expected string, received undefined\\n → at name","code":"INVALID_ARGUMENTS","is_retryable":true,"suggested_fix":"Please check the arguments and try again."}"`,
60+
);
6161
});
6262

6363
it("returns tool schemas with expected shape and memoizes the result", () => {

frontend/src/core/ai/tools/base.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export class ToolExecutionError extends Error {
5151
message: this.message,
5252
code: this.code,
5353
is_retryable: this.isRetryable,
54-
suggested_fix: this.suggestedFix,
55-
meta: this.meta ?? {},
54+
...(this.suggestedFix && { suggested_fix: this.suggestedFix }),
55+
...(this.meta && { meta: this.meta }),
5656
});
5757
return `Error invoking tool ${this.name}: ${stringError}`;
5858
}

0 commit comments

Comments
 (0)