Skip to content

Commit 893841b

Browse files
authored
Show error message in chromad (#1208)
This will show any error that is thrown by chroma in the web interface of chromad
1 parent fef8258 commit 893841b

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

cmd/chromad/static/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ function init() {
233233
const formData = getFormJSON();
234234
const value = await render(formData);
235235

236+
if (value.error) {
237+
throw new Error(value.error);
238+
}
239+
236240
if (value.language) {
237241
languageSelect.value = value.language;
238242
}
@@ -243,13 +247,9 @@ function init() {
243247
output.innerHTML = value.html;
244248
}
245249
} catch (error) {
246-
console.error("Error highlighting code:", error);
247-
// Fallback: display plain text
248-
if (htmlCheckbox.checked) {
249-
output.innerText = textArea.value;
250-
} else {
251-
output.innerHTML = `<pre>${textArea.value}</pre>`;
252-
}
250+
const errorMsg = `Error highlighting code: ${error}`;
251+
output.innerText = errorMsg;
252+
console.error(errorMsg);
253253
}
254254

255255
if (event) {

0 commit comments

Comments
 (0)