From 4293ea320d37969383bb3a17d48fd1ce65641f14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Tue, 3 Aug 2021 10:08:53 +0200 Subject: [PATCH] Hotfix: if an error occurs while loading the map (because the map is not accessible from the WorkAdventure servers), the application does not prevent users from connecting. --- back/src/Model/GameRoom.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/back/src/Model/GameRoom.ts b/back/src/Model/GameRoom.ts index e907fcb7..5667146a 100644 --- a/back/src/Model/GameRoom.ts +++ b/back/src/Model/GameRoom.ts @@ -473,7 +473,22 @@ export class GameRoom { const variablesManager = new VariablesManager(this.roomUrl, null); return variablesManager.init(); } else { - throw e; + // An error occurred while loading the map + // Right now, let's bypass the error. In the future, we should make sure the user is aware of that + // and that he/she will act on it to fix the problem. + + // Note: we run this message inside a setTimeout so that the room listeners can have time to connect. + setTimeout(() => { + for (const roomListener of this.roomListeners) { + emitErrorOnRoomSocket( + roomListener, + "Your map does not seem accessible from the WorkAdventure servers. Is it behind a firewall or a proxy? Your map should be accessible from the WorkAdventure servers. If you use the scripting API in this map, please be aware that server-side checks and variable persistence is disabled." + ); + } + }, 1000); + + const variablesManager = new VariablesManager(this.roomUrl, null); + return variablesManager.init(); } }); }