mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
WIP triage responses and handle websocket err
This commit is contained in:
@@ -28,6 +28,9 @@ export const ErrorProvider: React.FC<ErrorProviderProps> = ({ children }) => {
|
||||
const declareError = (error, humanMessage?) => {
|
||||
setError(error);
|
||||
setHumanMessage(humanMessage);
|
||||
console.log(error.message, { ...error });
|
||||
//TODO ignore not found in request errors (in useTopics, useTranscript...)
|
||||
// if (error.name == ResponseError && error.response.status == 404)
|
||||
};
|
||||
return (
|
||||
<ErrorContext.Provider
|
||||
|
||||
@@ -357,6 +357,15 @@ export const useWebSockets = (transcriptId: string | null): UseWebSockets => {
|
||||
newUrl,
|
||||
);
|
||||
}
|
||||
if (message.data.value === "error") {
|
||||
const newUrl = "/transcripts/" + transcriptId;
|
||||
router.push(newUrl);
|
||||
// TODO Test
|
||||
setError(
|
||||
Error("Websocket error status"),
|
||||
"There was an issue processing your transcript",
|
||||
);
|
||||
}
|
||||
setStatus(message.data);
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user