feat: doc upload error handling

This commit is contained in:
Timothy J. Baek 2024-01-08 01:54:03 -08:00
parent eddb6fc7b7
commit 1ff3eb8038
3 changed files with 13 additions and 5 deletions

View file

@ -29,7 +29,10 @@
};
const uploadDoc = async (file) => {
const res = await uploadDocToVectorDB(localStorage.token, '', file);
const res = await uploadDocToVectorDB(localStorage.token, '', file).catch((error) => {
toast.error(error);
return null;
});
if (res) {
await createNewDoc(
@ -38,7 +41,10 @@
res.filename,
transformFileName(res.filename),
res.filename
);
).catch((error) => {
toast.error(error);
return null;
});
await documents.set(await getDocs(localStorage.token));
}
};