Add errored plugins to plugin array for uninstalls

This commit is contained in:
TrainDoctor
2022-11-13 16:01:06 -08:00
parent 17742e947a
commit de42639726
+15 -1
View File
@@ -8,7 +8,7 @@ import {
sleep, sleep,
staticClasses, staticClasses,
} from 'decky-frontend-lib'; } from 'decky-frontend-lib';
import { lazy } from 'react'; import { FC, lazy } from 'react';
import { FaExclamationCircle, FaPlug } from 'react-icons/fa'; import { FaExclamationCircle, FaPlug } from 'react-icons/fa';
import { DeckyState, DeckyStateContextProvider, useDeckyState } from './components/DeckyState'; import { DeckyState, DeckyStateContextProvider, useDeckyState } from './components/DeckyState';
@@ -245,6 +245,20 @@ class PluginLoader extends Logger {
}); });
} catch (e) { } catch (e) {
this.error('Error loading plugin ' + name, e); this.error('Error loading plugin ' + name, e);
const TheError: FC<{}> = () => (
<>
Error:{' '}
<pre>
<code>{e}</code>
</pre>
</>
);
this.plugins.push({
name: name,
version: version,
content: <TheError />,
icon: <FaExclamationCircle />,
});
this.toaster.toast({ title: 'Error loading ' + name, body: '' + e, icon: <FaExclamationCircle /> }); this.toaster.toast({ title: 'Error loading ' + name, body: '' + e, icon: <FaExclamationCircle /> });
} }
} else throw new Error(`${name} frontend_bundle not OK`); } else throw new Error(`${name} frontend_bundle not OK`);