Handle onMessage errors when client is not connected
Reviewed By: lblasa Differential Revision: D47397641 fbshipit-source-id: ac9c057050a3bac0c5149f5ce2998657fededb61
This commit is contained in:
committed by
Facebook GitHub Bot
parent
257003af42
commit
0345d7d533
@@ -218,6 +218,7 @@ export default abstract class AbstractClient extends EventEmitter {
|
||||
|
||||
// get the plugins, and update the UI
|
||||
async refreshPlugins() {
|
||||
try {
|
||||
const oldBackgroundPlugins = this.backgroundPlugins;
|
||||
await this.loadPlugins('refresh');
|
||||
await Promise.all(
|
||||
@@ -242,6 +243,13 @@ export default abstract class AbstractClient extends EventEmitter {
|
||||
}
|
||||
});
|
||||
this.emit('plugins-change');
|
||||
} catch (e) {
|
||||
if (this.connected) {
|
||||
throw e;
|
||||
} else {
|
||||
console.warn(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onMessage(msg: string) {
|
||||
|
||||
Reference in New Issue
Block a user