Commit 195cfd4f authored by Rohit Das's avatar Rohit Das
Browse files

wip: displaying error in a toast

parent a7bec01d
......@@ -191,6 +191,15 @@
})
});
if (!res.ok) {
const error = await res.json();
console.log(error);
if ('detail' in error) {
toast.error(error.detail);
} else {
toast.error(error.error);
}
} else {
const reader = res.body
.pipeThrough(new TextDecoderStream())
.pipeThrough(splitStream('\n'))
......@@ -266,6 +275,7 @@
history: history
});
}
}
stopResponseFlag = false;
await tick();
......
......@@ -218,6 +218,15 @@
})
});
if (!res.ok) {
const error = await res.json();
console.log(error);
if ('detail' in error) {
toast.error(error.detail);
} else {
toast.error(error.error);
}
} else {
const reader = res.body
.pipeThrough(new TextDecoderStream())
.pipeThrough(splitStream('\n'))
......@@ -293,6 +302,7 @@
history: history
});
}
}
stopResponseFlag = false;
await tick();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment