fix: enhance error message in llamacloud (#1672)

This commit is contained in:
Thuc Pham
2025-02-20 16:33:34 +07:00
committed by GitHub
parent 6fcc6bcb84
commit 88d776f392
2 changed files with 10 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"llamaindex": patch
---
fix: enhance error message in llamacloud
+5
View File
@@ -31,6 +31,11 @@ export function initService({ apiKey, baseUrl }: ClientParams = {}) {
request.headers.set("Authorization", `Bearer ${token}`);
return request;
});
client.interceptors.error.use((error) => {
throw new Error(
`LlamaCloud API request failed. Error details: ${JSON.stringify(error)}`,
);
});
if (!token) {
throw new Error(
"API Key is required for LlamaCloudIndex. Please pass the apiKey parameter",