diff options
Diffstat (limited to 'frontend/src/plugin-loader.tsx')
| -rw-r--r-- | frontend/src/plugin-loader.tsx | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/frontend/src/plugin-loader.tsx b/frontend/src/plugin-loader.tsx index 400e7484..92c634c9 100644 --- a/frontend/src/plugin-loader.tsx +++ b/frontend/src/plugin-loader.tsx @@ -9,7 +9,7 @@ import { staticClasses, } from 'decky-frontend-lib'; import { lazy } from 'react'; -import { FaPlug } from 'react-icons/fa'; +import { FaExclamationCircle, FaPlug } from 'react-icons/fa'; import { DeckyState, DeckyStateContextProvider, useDeckyState } from './components/DeckyState'; import LegacyPlugin from './components/LegacyPlugin'; @@ -41,7 +41,7 @@ class PluginLoader extends Logger { private tabsHook: TabsHook = new TabsHook(); // private windowHook: WindowHook = new WindowHook(); private routerHook: RouterHook = new RouterHook(); - public toaster: Toaster = new Toaster(); + public toaster: Toaster = new Toaster(this.routerHook); private deckyState: DeckyState = new DeckyState(); private reloadLock: boolean = false; @@ -233,13 +233,18 @@ class PluginLoader extends Logger { }, }); if (res.ok) { - let plugin_export = await eval(await res.text()); - let plugin = plugin_export(this.createPluginAPI(name)); - this.plugins.push({ - ...plugin, - name: name, - version: version, - }); + try { + let plugin_export = await eval(await res.text()); + let plugin = plugin_export(this.createPluginAPI(name)); + this.plugins.push({ + ...plugin, + name: name, + version: version, + }); + } catch (e) { + this.error('Error loading plugin ' + name, e); + this.toaster.toast({ title: 'Error loading ' + name, body: '' + e, icon: <FaExclamationCircle /> }); + } } else throw new Error(`${name} frontend_bundle not OK`); } |
