From 2dc7438cbadfd6e284dc35e808a38b53353f7813 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 23 Dec 2020 11:55:54 +0100 Subject: [PATCH] Fix invalid LKH in roster --- www/common/outer/roster.js | 18 +++++++++++++----- www/common/outer/team.js | 6 +++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/www/common/outer/roster.js b/www/common/outer/roster.js index 2c2675037..7dbf544c2 100644 --- a/www/common/outer/roster.js +++ b/www/common/outer/roster.js @@ -1,5 +1,5 @@ (function () { -var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) { +var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto, Feedback) { var Roster = {}; // this constant is somewhat arbitrary. @@ -587,6 +587,11 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) { // deleted while you are open // emit an event var onChannelError = function (info) { + Feedback.send('ROSTER_CHANNEL_ERROR='+info.type); + if (info.type === "EUNKNOWN") { + // chainpad-netflux should recover by itself + return; + } if (!ready) { return void cb(info); } console.error("CHANNEL_ERROR", info); }; @@ -870,7 +875,8 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) { require("../../bower_components/chainpad-netflux/chainpad-netflux.js"), require("../../bower_components/json.sortify"), require("nthen"), - require("../../bower_components/chainpad-crypto/crypto") + require("../../bower_components/chainpad-crypto/crypto"), + null // no feedback here ); } else if ((typeof(define) !== 'undefined' && define !== null) && (define.amd !== null)) { require.config({ paths: { 'json.sortify': '/bower_components/json.sortify/dist/JSON.sortify' } }); @@ -880,16 +886,18 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) { '/bower_components/chainpad-netflux/chainpad-netflux.js', 'json.sortify', '/bower_components/nthen/index.js', - '/bower_components/chainpad-crypto/crypto.js' + '/bower_components/chainpad-crypto/crypto.js', + '/common/common-feedback.js', //'/bower_components/tweetnacl/nacl-fast.min.js', - ], function (Util, Hash, CPNF, Sortify, nThen, Crypto) { + ], function (Util, Hash, CPNF, Sortify, nThen, Crypto, Feedback) { return factory.apply(null, [ Util, Hash, CPNF, Sortify, nThen, - Crypto + Crypto, + Feedback ]); }); } else { diff --git a/www/common/outer/team.js b/www/common/outer/team.js index 38e83608a..cba26189f 100644 --- a/www/common/outer/team.js +++ b/www/common/outer/team.js @@ -1796,7 +1796,11 @@ define([ teams[id].keys.mailbox = deriveMailbox(teams[id]); } openChannel(ctx, teams[id], id, waitFor(function (err) { - if (err) { return void console.error(err); } + if (err) { + var txt = typeof(err) === "string" ? err : (err.type || err.message); + Feedback.send("TEAM_LOADING_ERROR="+txt); + return void console.error(err); + } console.debug('Team '+id+' ready'); })); });