Commit 5b1eea97 5b1eea97852890ce75ce968e67caa985875642c4 by Nicolas Perriault

refs #159 - better error message in case getGlobal() failed

1 parent 7145ddd7
...@@ -733,7 +733,9 @@ Casper.prototype.getGlobal = function getGlobal(name) { ...@@ -733,7 +733,9 @@ Casper.prototype.getGlobal = function getGlobal(name) {
733 } 733 }
734 return result; 734 return result;
735 }, {'name': name}); 735 }, {'name': name});
736 if ('error' in result) { 736 if (typeof result !== "object") {
737 throw new CasperError(f('Could not retrieve global value for "%s"', name));
738 } else if ('error' in result) {
737 throw new CasperError(result.error); 739 throw new CasperError(result.error);
738 } else if (utils.isString(result.value)) { 740 } else if (utils.isString(result.value)) {
739 return JSON.parse(result.value); 741 return JSON.parse(result.value);
......