Fix error handling in plugin loading
Summary: If a device plugin throw an error in it's initialization, it would prevent the device itself from being registered. This fixes that. As shown in the comments of for example: https://fb.workplace.com/groups/flippersupport/permalink/1218627761951213/ Reviewed By: ananyaarun Differential Revision: D31127969 fbshipit-source-id: 9824d23b275f1f9e866f841035961e4707ff8e04
This commit is contained in:
committed by
Facebook GitHub Bot
parent
40f20f6785
commit
a72e46c792
@@ -306,17 +306,21 @@ export default class BaseDevice implements Device {
|
||||
}
|
||||
this.hasDevicePlugins = true;
|
||||
if (plugin instanceof _SandyPluginDefinition) {
|
||||
this.sandyPluginStates.set(
|
||||
plugin.id,
|
||||
new _SandyDevicePluginInstance(
|
||||
getFlipperLib(),
|
||||
plugin,
|
||||
this,
|
||||
// break circular dep, one of those days again...
|
||||
getPluginKey(undefined, {serial: this.serial}, plugin.id),
|
||||
initialState,
|
||||
),
|
||||
);
|
||||
try {
|
||||
this.sandyPluginStates.set(
|
||||
plugin.id,
|
||||
new _SandyDevicePluginInstance(
|
||||
getFlipperLib(),
|
||||
plugin,
|
||||
this,
|
||||
// break circular dep, one of those days again...
|
||||
getPluginKey(undefined, {serial: this.serial}, plugin.id),
|
||||
initialState,
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
console.error(`Failed to start device plugin '${plugin.id}': `, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user