refs #159 - better error message in case getGlobal() failed
Showing
1 changed file
with
3 additions
and
1 deletions
... | @@ -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); | ... | ... |
-
Please register or sign in to post a comment