Skip to content

Commit

Permalink
BC-7875 Update error mapping (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyedwiper authored Aug 26, 2024
1 parent 78d1db6 commit 726e4d7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/hooks/useWebsocketErrorHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ const websocketErrors = [
httpCode: HttpStatusCode.InternalServerError,
translationMessageKey: "error.4500",
},
// This mapping of code 1011 is for the new server, which does not use the above codes.
// When the transition to the new server is complete, the error handling can be revised.
{
websocketCode: 1011,
httpCode: HttpStatusCode.InternalServerError,
translationMessageKey: "error.4500",
},
];

export function useWebsocketErrorHandler() {
Expand All @@ -39,6 +46,7 @@ export function useWebsocketErrorHandler() {
const error = websocketErrors.find(
(element) => element.websocketCode === event.code,
);

if (!error) return;
// not acceptable means we have to wait for the server to accept us
// keep reconnecting
Expand Down

0 comments on commit 726e4d7

Please sign in to comment.