fix(FN-920): improve error handling in subtask breakdown SSE stream
- Handle empty error messages in subtask-breakdown session by falling back to 'Unknown error' - Fix backend SSE routes to coerce error data to string and handle missing message - Improve frontend connectSubtaskStream to validate parsed error data before displaying - Add tests for error display in SubtaskBreakdownModal component
This commit is contained in:
@@ -373,4 +373,21 @@ describe("SubtaskBreakdownModal", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("error handling", () => {
|
||||
it("displays error message when stream returns error event", async () => {
|
||||
renderModal();
|
||||
await waitFor(() => expect(streamHandlers).toBeDefined());
|
||||
streamHandlers.onError("Something went wrong");
|
||||
expect(await screen.findByText("Something went wrong")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows Stream error fallback when receiving empty error", async () => {
|
||||
renderModal();
|
||||
await waitFor(() => expect(streamHandlers).toBeDefined());
|
||||
// In real flow, api.ts converts empty string to "Stream error" before calling onError
|
||||
streamHandlers.onError("Stream error");
|
||||
expect(await screen.findByText("Stream error")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user