Mercurial > hg > batmud > gmap2
changeset 292:64f67ed89172 gmap2
Use a wrapper function for errors.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 18 Nov 2016 23:24:44 +0200 |
parents | 55999edef91d |
children | 0a14a25a5f15 |
files | map.js |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/map.js Fri Nov 18 23:22:56 2016 +0200 +++ b/map.js Fri Nov 18 23:24:44 2016 +0200 @@ -210,6 +210,12 @@ } +function pmapError(msg) +{ + alert(msg); +} + + function pmapUpdatePlayerPosition() { XDownloadUrl("http://tnsp.org/gmapng/playerpos.php?name="+pmapPlrName+"&token="+pmapPlrToken, @@ -222,7 +228,7 @@ // Check response if (dmatches = data.match(/^Error: (.*)$/)) { - alert("An error occured: "+ dmatches[1]); + pmapError("An error occured: "+ dmatches[1]); return false; } else @@ -253,7 +259,7 @@ { pmapUpdateDelay = 10000; if (pmapUpdateFails++ > 5) - alert("An error occured: Server failed to respond."); + pmapError("An error occured: Server failed to respond."); else pmapScheduleNextUpdate(); });