diff options
author | LawnCable <lawncable.tmw2@simonlaux.de> | 2018-06-29 00:07:56 +0200 |
---|---|---|
committer | LawnCable <lawncable.tmw2@simonlaux.de> | 2018-06-29 00:07:56 +0200 |
commit | 5fcd4751188ce49ccd04e710b990711ae236e180 (patch) | |
tree | 330797286d8720a7a56ed4ab0d331312026ef31d | |
parent | 73107257b3bc2c29c553be0df36e9d5248bd78c2 (diff) | |
download | electron-5fcd4751188ce49ccd04e710b990711ae236e180.tar.gz electron-5fcd4751188ce49ccd04e710b990711ae236e180.tar.bz2 electron-5fcd4751188ce49ccd04e710b990711ae236e180.tar.xz electron-5fcd4751188ce49ccd04e710b990711ae236e180.zip |
- Some Error handeling related bugfixes
-rw-r--r-- | src/main/manaplus/manaplus.ts | 7 | ||||
-rw-r--r-- | src/renderer/gameserver/TOSCheck.ts | 3 | ||||
-rw-r--r-- | src/renderer/gameserver/news.ts | 3 |
3 files changed, 11 insertions, 2 deletions
diff --git a/src/main/manaplus/manaplus.ts b/src/main/manaplus/manaplus.ts index 9183b94..2f028b8 100644 --- a/src/main/manaplus/manaplus.ts +++ b/src/main/manaplus/manaplus.ts @@ -42,7 +42,8 @@ export namespace ManaPlus{ //params = ['-v'];// DEBUG: This option is to disable manaplus for testing (open it just for getting the version) } catch (e){ console.log(e); - Status.showError("Launch Preperation Failed", e.message, "Launch preparation failed") + Status.showError("Launch Preperation Failed (LPF_PARMS)", e.message, "Launch preparation failed"); + Status.setPlaying(false); return; } let willUpdate:boolean=false; @@ -54,7 +55,9 @@ export namespace ManaPlus{ willUpdate = (version.isNewVersion && await updateDialog(version.newestVersion)); } catch (e){ console.log(e); - Status.showError("Launch Preperation Failed", e.message, "Launch preparation failed") + Status.showError("Launch Preperation Failed (LPF_Update): This error can also mean that you are offline, \ +please check you network connection first.", e.message, "Launch preparation failed") + Status.setPlaying(false); return; } } else { diff --git a/src/renderer/gameserver/TOSCheck.ts b/src/renderer/gameserver/TOSCheck.ts index 8dc29f2..e2e4bfc 100644 --- a/src/renderer/gameserver/TOSCheck.ts +++ b/src/renderer/gameserver/TOSCheck.ts @@ -35,6 +35,9 @@ function request(url:string):Promise<string>{ return new Promise((res, rej)=>{ var xhr = new XMLHttpRequest(); xhr.open('GET', url); + xhr.addEventListener("error", (ev)=>{ + rej(ev); + }); xhr.onload = function() { if (xhr.status === 200) { res(xhr.responseText); diff --git a/src/renderer/gameserver/news.ts b/src/renderer/gameserver/news.ts index b748777..094172c 100644 --- a/src/renderer/gameserver/news.ts +++ b/src/renderer/gameserver/news.ts @@ -26,6 +26,9 @@ export namespace News { // Fetches only the most recent entry function request(url:string):Promise<string>{ return new Promise((res, rej)=>{ var xhr = new XMLHttpRequest(); + xhr.addEventListener("error", (ev)=>{ + rej(ev); + }); xhr.open('GET', url); xhr.onload = function() { if (xhr.status === 200) { |