Add FlipperServerDisconnectedError to prevent excessive error logging
Reviewed By: passy Differential Revision: D51393196 fbshipit-source-id: f49857b397a3fb629ad44f89a4c59b12ba2f67c4
This commit is contained in:
committed by
Facebook GitHub Bot
parent
7c972a982a
commit
d515342526
@@ -11,6 +11,7 @@ import {
|
||||
InstalledPluginDetails,
|
||||
tryCatchReportPluginFailuresAsync,
|
||||
notNull,
|
||||
FlipperServerDisconnectedError,
|
||||
} from 'flipper-common';
|
||||
import {ActivatablePluginDetails, ConcretePluginDetails} from 'flipper-common';
|
||||
import {reportUsage} from 'flipper-common';
|
||||
@@ -229,7 +230,15 @@ export const createRequirePluginFunction =
|
||||
return pluginDefinition;
|
||||
} catch (e) {
|
||||
failedPlugins.push([pluginDetails, e.message]);
|
||||
console.error(`Plugin ${pluginDetails.id} failed to load`, e);
|
||||
|
||||
let severity: 'error' | 'warn' = 'error';
|
||||
if (
|
||||
e instanceof FlipperServerDisconnectedError &&
|
||||
e.reason === 'ws-close'
|
||||
) {
|
||||
severity = 'warn';
|
||||
}
|
||||
console[severity](`Plugin ${pluginDetails.id} failed to load`, e);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user