mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 20:50:34 +00:00
feat(errors): Make errors more informative (#7133)
This commit is contained in:
parent
6fb01ddcc4
commit
3e74ff71b7
8 changed files with 133 additions and 11 deletions
|
|
@ -48,6 +48,7 @@ vi.mock('@google/gemini-cli-core', async () => {
|
|||
|
||||
const mockToolRegistry = {
|
||||
getTool: vi.fn(),
|
||||
getAllToolNames: vi.fn(() => ['mockTool', 'anotherTool']),
|
||||
};
|
||||
|
||||
const mockConfig = {
|
||||
|
|
@ -427,11 +428,17 @@ describe('useReactToolScheduler', () => {
|
|||
request,
|
||||
response: expect.objectContaining({
|
||||
error: expect.objectContaining({
|
||||
message: 'Tool "nonexistentTool" not found in registry.',
|
||||
message: expect.stringMatching(
|
||||
/Tool "nonexistentTool" not found in registry/,
|
||||
),
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
]);
|
||||
const errorMessage = onComplete.mock.calls[0][0][0].response.error.message;
|
||||
expect(errorMessage).toContain('Did you mean one of:');
|
||||
expect(errorMessage).toContain('"mockTool"');
|
||||
expect(errorMessage).toContain('"anotherTool"');
|
||||
expect(result.current[0]).toEqual([]);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue