output error details in axios client

This commit is contained in:
Sha Zhou 2025-08-20 18:21:24 +08:00
parent 9516ce1aa6
commit a310352d82
2 changed files with 15 additions and 2 deletions

View File

@ -121,8 +121,9 @@ async function getBatchEmbeddingsWithRetry(
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${JINA_API_KEY}`
}
}
},
timeout: 60000,
},
);
if (!response.data.data) {

View File

@ -55,6 +55,18 @@ const axiosClient = axios.create(baseConfig);
axiosClient.interceptors.response.use(
(response) => response,
(error) => {
logError('Request error:', {
details: {
url: error.config.url,
payload: error.config.data,
message: error.message,
code: error.code,
response: error.response ? {
status: error.response.status,
data: error.response.data,
} : undefined,
}
});
if (error.code === 'ECONNABORTED') {
error.request?.destroy?.();
}