From 2b6e585fd2b89e93deba09870b753b542101464b Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Tue, 27 Apr 2021 04:38:19 -0700 Subject: [PATCH] Improve plugin loading error message Summary: I was a dummy and ran into this. Tried to make it easier for the next person to figure out what this means. Reviewed By: mweststrate Differential Revision: D28026376 fbshipit-source-id: ad3455938ef30b448b475cb990f86351e76628bf --- desktop/app/src/dispatcher/plugins.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/desktop/app/src/dispatcher/plugins.tsx b/desktop/app/src/dispatcher/plugins.tsx index ccd87feaa..73813d6b0 100644 --- a/desktop/app/src/dispatcher/plugins.tsx +++ b/desktop/app/src/dispatcher/plugins.tsx @@ -289,8 +289,16 @@ const requirePluginInternal = ( if (plugin.default) { plugin = plugin.default; } - if (!(plugin.prototype instanceof FlipperBasePlugin)) { - throw new Error(`Plugin ${plugin.name} is not a FlipperBasePlugin`); + if (plugin.prototype === undefined) { + throw new Error( + `Plugin ${pluginDetails.name} is neither a class-based plugin nor a Sandy-based one. + Ensure that it exports either a FlipperPlugin class or has flipper-plugin declared as a peer-dependency and exports a plugin and Component. + See https://fbflipper.com/docs/extending/sandy-migration/ for more information.`, + ); + } else if (!(plugin.prototype instanceof FlipperBasePlugin)) { + throw new Error( + `Plugin ${pluginDetails.name} is not a FlipperBasePlugin`, + ); } if (plugin.id && pluginDetails.id !== plugin.id) {