diff options
author | Andrew Dolgov <[email protected]> | 2011-03-18 17:39:23 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2011-03-18 17:39:23 +0300 |
commit | ebb948c24e667f651fe882100cc478f0534b8760 (patch) | |
tree | ad1817f8625575ba03614863e413bb1acb869a66 /functions.js | |
parent | 81f6deea473257379ef43ceb07077527b9d91dbb (diff) |
rework initial sanitycheck to use JSON
Diffstat (limited to 'functions.js')
-rw-r--r-- | functions.js | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/functions.js b/functions.js index 411c82494..ba82ebe11 100644 --- a/functions.js +++ b/functions.js @@ -1055,36 +1055,26 @@ function backend_sanity_check_callback(transport) { return; } - if (!transport.responseXML) { - if (!store) { - fatalError(3, "Sanity check: Received reply is not XML", - transport.responseText); - return; - } - } - - var reply = transport.responseXML.getElementsByTagName("error")[0]; + var reply = JSON.parse(transport.responseText); if (!reply) { fatalError(3, "Sanity check: invalid RPC reply", transport.responseText); return; } - var error_code = reply.getAttribute("error-code"); + var error_code = reply['error']['code']; if (error_code && error_code != 0) { - return fatalError(error_code, reply.getAttribute("error-msg")); + return fatalError(error_code, reply['error']['message']); } console.log("sanity check ok"); - var params = transport.responseXML.getElementsByTagName("init-params")[0]; + var params = reply['init-params']; if (params) { console.log('reading init-params...'); - params = JSON.parse(params.firstChild.nodeValue); - if (params) { for (k in params) { var v = params[k]; |