aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-04-07 18:36:11 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-04-07 18:36:11 +0800
commit7c583f82228fb373dd6bbe15effb68cf5aac0ad9 (patch)
tree63070588c19462701188d23ba317b181b0bfb2b0
parent9c55576c7b415954773c062d404a736741fb9794 (diff)
parentb09d62bac7b46f2ebb45da4d4219d6e96aee3768 (diff)
downloadgo-tangerine-7c583f82228fb373dd6bbe15effb68cf5aac0ad9.tar
go-tangerine-7c583f82228fb373dd6bbe15effb68cf5aac0ad9.tar.gz
go-tangerine-7c583f82228fb373dd6bbe15effb68cf5aac0ad9.tar.bz2
go-tangerine-7c583f82228fb373dd6bbe15effb68cf5aac0ad9.tar.lz
go-tangerine-7c583f82228fb373dd6bbe15effb68cf5aac0ad9.tar.xz
go-tangerine-7c583f82228fb373dd6bbe15effb68cf5aac0ad9.tar.zst
go-tangerine-7c583f82228fb373dd6bbe15effb68cf5aac0ad9.zip
Merge pull request #653 from debris/circular_structure
fixed printing circular structures
-rw-r--r--jsre/pp_js.go16
1 files changed, 6 insertions, 10 deletions
diff --git a/jsre/pp_js.go b/jsre/pp_js.go
index 2badb90e7..5c09b2586 100644
--- a/jsre/pp_js.go
+++ b/jsre/pp_js.go
@@ -2,17 +2,13 @@ package jsre
const pp_js = `
function pp(object, indent) {
- var str = "";
- /*
- var o = object;
try {
- object = JSON.stringify(object)
- object = JSON.parse(object);
- } catch(e) {
- object = o;
- }
- */
+ JSON.stringify(object)
+ } catch(e) {
+ return pp(e, indent);
+ }
+ var str = "";
if(object instanceof Array) {
str += "[";
for(var i = 0, l = object.length; i < l; i++) {
@@ -24,7 +20,7 @@ function pp(object, indent) {
}
str += " ]";
} else if (object instanceof Error) {
- str += "\033[31m" + "Error";
+ str += "\033[31m" + "Error:\033[0m " + object.message;
} else if (isBigNumber(object)) {
str += "\033[32m'" + object.toString(10) + "'";
} else if(typeof(object) === "object") {