browser: fix error display.

This commit is contained in:
Christopher Jeffrey 2017-12-28 18:41:09 -08:00
parent 94fd001e88
commit 761ae4a80c
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
4 changed files with 33 additions and 32 deletions

View File

@ -7,12 +7,5 @@
"useBuiltins": "usage", "useBuiltins": "usage",
"loose": true "loose": true
}] }]
],
"plugins": [
["transform-runtime", {
"helpers": true,
"polyfill": true,
"regenerator": true
}]
] ]
} }

View File

@ -64,13 +64,16 @@ const node = new FullNode({
workers: true, workers: true,
workerFile: '/worker.js', workerFile: '/worker.js',
createSocket: (port, host) => { createSocket: (port, host) => {
return ProxySocket.connect('ws://127.0.0.1:8080', port, host); const proto = global.location.protocol === 'https:' ? 'wss' : 'ws';
const hostname = global.location.host;
return ProxySocket.connect(`${proto}://${hostname}`, port, host);
}, },
logger: logger, logger: logger,
plugins: [plugin] plugins: [plugin]
}); });
const {wdb} = node.require('walletdb'); const {wdb} = node.require('walletdb');
wdb.options.witness = true;
window.onunhandledrejection = function onunhandledrejection(event) { window.onunhandledrejection = function onunhandledrejection(event) {
throw event.reason; throw event.reason;
@ -86,6 +89,11 @@ floating.onmouseup = function onmouseup(ev) {
}; };
function show(obj) { function show(obj) {
if (obj instanceof Error) {
floating.innerHTML = obj.stack;
floating.style.display = 'block';
return;
}
const json = obj && obj.toJSON ? obj.toJSON() : null; const json = obj && obj.toJSON ? obj.toJSON() : null;
floating.innerHTML = escape(JSON.stringify(json, null, 2)); floating.innerHTML = escape(JSON.stringify(json, null, 2));
floating.style.display = 'block'; floating.style.display = 'block';

View File

@ -382,7 +382,7 @@ class Account {
throw new Error(`Bad branch: ${branch}.`); throw new Error(`Bad branch: ${branch}.`);
} }
this.save(); this.save(b);
return key; return key;
} }
@ -961,8 +961,8 @@ Account.types = {
*/ */
Account.typesByVal = [ Account.typesByVal = [
'pubkeyhash', 'PUBKEYHASH',
'multisig' 'MULTISIG'
]; ];
/** /**

View File

@ -23,27 +23,27 @@
"node": ">=7.6.0" "node": ">=7.6.0"
}, },
"dependencies": { "dependencies": {
"bclient": "^0.0.0", "bcfg": "~0.0.0",
"bcfg": "^0.0.0", "bclient": "~0.0.0",
"bcrypto": "^0.0.0", "bcrypto": "~0.0.0",
"bdb": "^0.0.0", "bdb": "~0.0.0",
"bdns": "^0.0.0", "bdns": "~0.0.0",
"bevent": "^0.0.0", "bevent": "~0.0.0",
"bfile": "^0.0.0", "bfile": "~0.0.0",
"bfilter": "^0.0.0", "bfilter": "~0.0.0",
"binet": "^0.0.0", "binet": "~0.0.0",
"blgr": "^0.0.0", "blgr": "~0.0.0",
"bmutex": "^0.0.0", "bmutex": "~0.0.0",
"bn.js": "^4.11.8", "bn.js": "~4.11.8",
"bsock": "^0.0.0", "bsock": "~0.0.0",
"bsocks": "^0.0.0", "bsocks": "~0.0.0",
"bstring": "^0.0.0", "bstring": "~0.0.0",
"btcp": "^0.0.0", "btcp": "~0.0.0",
"bufio": "^0.0.0", "bufio": "~0.0.0",
"bupnp": "^0.0.0", "bupnp": "~0.0.0",
"bval": "^0.0.0", "bval": "~0.0.0",
"bweb": "^0.0.0", "bweb": "~0.0.0",
"n64": "^0.0.18" "n64": "~0.1.0"
}, },
"devDependencies": { "devDependencies": {
"babel-core": "^6.26.0", "babel-core": "^6.26.0",