# HG changeset patch # User Nicholas Jillings # Date 1477303315 -3600 # Node ID fb8f43204ae0e95791cfe879cc9d3079e7805e3e # Parent 4cbd314e5d9f3f68f9c048a54887bc6227f12157 Fix for #158 diff -r 4cbd314e5d9f -r fb8f43204ae0 js/core.js --- 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) { diff -r 4cbd314e5d9f -r fb8f43204ae0 php/keygen.php --- 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 = "OK".$key_requested.""; $xml_bad = "NO".$key_requested.""; -$xml_error = "ERROR".$key_requested.""; +$xml_error = "ERROR".$key_requested."Could not open file for writing"; if (is_array($saves)) { foreach($saves as $filename) { diff -r 4cbd314e5d9f -r fb8f43204ae0 php/requestKey.php --- 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 "ERROR".$key.""; + echo "ERROR".$key."Could not open file for writing"; return; } fclose($fileHandle);