fix(error): add global error handler, fix stores and dispatcher
- Global unhandledrejection handler with IPC+network filtering - Agent dispatcher heartbeat uses handleInfraError (was fire-and-forget) - All stores: layout, workspace, anchors, theme, plugins, machines, wake-scheduler — silent failures replaced with handleInfraError - initGlobalErrorHandler() called in App.svelte onMount
This commit is contained in:
parent
8b3b0ab720
commit
93b3db8b1f
10 changed files with 73 additions and 35 deletions
|
|
@ -7,6 +7,7 @@ import type { PluginMeta } from '../adapters/plugins-bridge';
|
|||
import { discoverPlugins } from '../adapters/plugins-bridge';
|
||||
import { getSetting, setSetting } from '../adapters/settings-bridge';
|
||||
import { loadPlugin, unloadPlugin, unloadAllPlugins, getLoadedPlugins } from '../plugins/plugin-host';
|
||||
import { handleInfraError } from '../utils/handle-error';
|
||||
import type { GroupId, AgentId } from '../types/ids';
|
||||
|
||||
// --- Plugin command registry (for CommandPalette) ---
|
||||
|
|
@ -65,7 +66,7 @@ class PluginEventBusImpl {
|
|||
try {
|
||||
cb(data);
|
||||
} catch (e) {
|
||||
console.error(`Plugin event handler error for '${event}':`, e);
|
||||
handleInfraError(e, `plugins.eventHandler(${event})`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -140,7 +141,7 @@ async function loadSinglePlugin(
|
|||
);
|
||||
} catch (e) {
|
||||
const errorMsg = e instanceof Error ? e.message : String(e);
|
||||
console.error(`Failed to load plugin '${entry.meta.id}':`, errorMsg);
|
||||
handleInfraError(e, `plugins.loadPlugin(${entry.meta.id})`);
|
||||
pluginEntries = pluginEntries.map(e =>
|
||||
e.meta.id === entry.meta.id ? { ...e, status: 'error' as PluginStatus, error: errorMsg } : e,
|
||||
);
|
||||
|
|
@ -161,7 +162,7 @@ export async function loadAllPlugins(groupId?: GroupId, agentId?: AgentId): Prom
|
|||
try {
|
||||
discovered = await discoverPlugins();
|
||||
} catch (e) {
|
||||
console.error('Failed to discover plugins:', e);
|
||||
handleInfraError(e, 'plugins.discover');
|
||||
pluginEntries = [];
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue