MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / mergePluginErrors

Function mergePluginErrors

src/utils/plugins/refresh.ts:207–217  ·  view source on GitHub ↗

* Merge fresh plugin-load errors with existing errors, preserving LSP and * plugin-component errors that were recorded by other systems and * deduplicating. Same logic as refreshPlugins()/updatePluginState(), extracted * so refresh.ts doesn't leave those errors stranded.

(
  existing: PluginError[],
  fresh: PluginError[],
)

Source from the content-addressed store, hash-verified

205 * so refresh.ts doesn't leave those errors stranded.
206 */
207function mergePluginErrors(
208 existing: PluginError[],
209 fresh: PluginError[],
210): PluginError[] {
211 const preserved = existing.filter(
212 e => e.source === 'lsp-manager' || e.source.startsWith('plugin:'),
213 )
214 const freshKeys = new Set(fresh.map(errorKey))
215 const deduped = preserved.filter(e => !freshKeys.has(errorKey(e)))
216 return [...deduped, ...fresh]
217}
218
219function errorKey(e: PluginError): string {
220 return e.type === 'generic-error'

Callers 1

refreshActivePluginsFunction · 0.85

Calls 2

errorKeyFunction · 0.85
hasMethod · 0.45

Tested by

no test coverage detected