Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion frontend/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,18 @@ class ExtendedChainlitAPI extends ChainlitAPI {
...(headers ? { headers } : {})
})
}).then(async (res) => {
if (!res.ok) {
let detail: string | undefined;
try {
const data = await res.json();
detail = data.detail;
} catch {
// Response body is not JSON (e.g. proxy HTML error page)
}
throw new ClientError(detail || res.statusText, res.status);
}
const data = await res.json();
return { success: res.ok, mcp: data.mcp, error: data.detail };
return { success: true, mcp: data.mcp, error: undefined };
});
}
}
Expand Down
Loading