Mercurial > hg > webaudioevaluationtool
changeset 2514:fb8f43204ae0
Fix for #158
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Mon, 24 Oct 2016 11:01:55 +0100 |
parents | 4cbd314e5d9f |
children | 913d7c132ab6 |
files | js/core.js php/keygen.php php/requestKey.php |
diffstat | 3 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/js/core.js Mon Oct 24 10:57:50 2016 +0100 +++ b/js/core.js Mon Oct 24 11:01:55 2016 +0100 @@ -3141,6 +3141,9 @@ this.parent.root.setAttribute("key", this.key); this.parent.root.setAttribute("state", "empty"); shouldGenerateKey = false; + } else if (xml.getElementsByTagName("state")[0].textContent == "ERROR") { + console.error("Could not generate server key. Server responded with error message: \"" + xml.getElementsByTagName("message")[0].textContent + "\""); + shouldGenerateKey = false; } } if (shouldGenerateKey === true) {
--- a/php/keygen.php Mon Oct 24 10:57:50 2016 +0100 +++ b/php/keygen.php Mon Oct 24 11:01:55 2016 +0100 @@ -10,7 +10,7 @@ $xml_good = "<response><state>OK</state><key>".$key_requested."</key></response>"; $xml_bad = "<response><state>NO</state><key>".$key_requested."</key></response>"; -$xml_error = "<response><state>ERROR</state><key>".$key_requested."</key></response>"; +$xml_error = "<response><state>ERROR</state><key>".$key_requested."</key><message>Could not open file for writing</message></response>"; if (is_array($saves)) { foreach($saves as $filename) {
--- a/php/requestKey.php Mon Oct 24 10:57:50 2016 +0100 +++ b/php/requestKey.php Mon Oct 24 11:01:55 2016 +0100 @@ -44,7 +44,7 @@ $filename = "../saves/save-".$key.".xml"; $fileHandle = fopen($filename, 'w'); if ($fileHandle == FALSE) { - echo "<response><state>ERROR</state><key>".$key."</key></response>"; + echo "<response><state>ERROR</state><key>".$key."</key><message>Could not open file for writing</message></response>"; return; } fclose($fileHandle);