More descriptive error handling.

This commit is contained in:
BlipRanger
2023-07-05 23:33:32 -04:00
committed by GitHub
parent 13ba5cec49
commit c9db2f7c9c

View File

@@ -318,7 +318,12 @@ async function onExportClick() {
link.click();
document.body.removeChild(link);
} else {
toastr.error('An error occurred while attempting to download the data');
//Show the error from the result without the html, only what's in the body paragraph
let parser = new DOMParser();
let error = await exportResult.text();
let doc = parser.parseFromString(error, 'text/html');
let errorMessage = doc.querySelector('p').textContent;
toastr.error(`An error occurred while attempting to download the data from ChromaDB: ${errorMessage}`);
}
}