From 864c826a57e2d82c75a8d3fe821d441454794b62 Mon Sep 17 00:00:00 2001 From: Mubashir Osmani Date: Fri, 10 Jul 2026 21:46:55 +0000 Subject: [PATCH] fix(ui): surface a visible error when secure share link creation fails Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../src/components/shared/CreatedKeyDisplay.test.tsx | 5 ++--- .../src/components/shared/CreatedKeyDisplay.tsx | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/litellm-dashboard/src/components/shared/CreatedKeyDisplay.test.tsx b/ui/litellm-dashboard/src/components/shared/CreatedKeyDisplay.test.tsx index f6c2c873d85..27b2e3fcc94 100644 --- a/ui/litellm-dashboard/src/components/shared/CreatedKeyDisplay.test.tsx +++ b/ui/litellm-dashboard/src/components/shared/CreatedKeyDisplay.test.tsx @@ -94,16 +94,15 @@ describe("CreatedKeyDisplay", () => { expect(screen.getByRole("button", { name: /copy share link/i })).toBeInTheDocument(); }); - it("should not display a share link when the share call fails", async () => { + it("should surface an error and show no link when the share call fails", async () => { const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime }); vi.mocked(keyShareCreateCall).mockRejectedValue(new Error("boom")); - const consoleError = vi.spyOn(console, "error").mockImplementation(() => {}); render(); await user.click(screen.getByRole("button", { name: /securely share/i })); expect(keyShareCreateCall).toHaveBeenCalled(); + expect(vi.mocked(MessageManager.error)).toHaveBeenCalledWith("Failed to create secure share link. boom"); expect(screen.queryByRole("button", { name: /copy share link/i })).not.toBeInTheDocument(); - consoleError.mockRestore(); }); }); diff --git a/ui/litellm-dashboard/src/components/shared/CreatedKeyDisplay.tsx b/ui/litellm-dashboard/src/components/shared/CreatedKeyDisplay.tsx index 02bfea1fd0a..512a5f8793a 100644 --- a/ui/litellm-dashboard/src/components/shared/CreatedKeyDisplay.tsx +++ b/ui/litellm-dashboard/src/components/shared/CreatedKeyDisplay.tsx @@ -42,7 +42,8 @@ const CreatedKeyDisplay: React.FC = ({ apiKey, accessTok setShareLink(response.share_link); MessageManager.success("Secure share link created"); } catch (error) { - console.error("Failed to create secure share link:", error); + const detail = error instanceof Error ? error.message : "Please try again."; + MessageManager.error(`Failed to create secure share link. ${detail}`); } finally { setSharing(false); }