(error: PluginError)
| 293 | * Useful for logging and simple error displays |
| 294 | */ |
| 295 | export function getPluginErrorMessage(error: PluginError): string { |
| 296 | switch (error.type) { |
| 297 | case 'generic-error': |
| 298 | return error.error |
| 299 | case 'path-not-found': |
| 300 | return `Path not found: ${error.path} (${error.component})` |
| 301 | case 'git-auth-failed': |
| 302 | return `Git authentication failed (${error.authType}): ${error.gitUrl}` |
| 303 | case 'git-timeout': |
| 304 | return `Git ${error.operation} timeout: ${error.gitUrl}` |
| 305 | case 'network-error': |
| 306 | return `Network error: ${error.url}${error.details ? ` - ${error.details}` : ''}` |
| 307 | case 'manifest-parse-error': |
| 308 | return `Manifest parse error: ${error.parseError}` |
| 309 | case 'manifest-validation-error': |
| 310 | return `Manifest validation failed: ${error.validationErrors.join(', ')}` |
| 311 | case 'plugin-not-found': |
| 312 | return `Plugin ${error.pluginId} not found in marketplace ${error.marketplace}` |
| 313 | case 'marketplace-not-found': |
| 314 | return `Marketplace ${error.marketplace} not found` |
| 315 | case 'marketplace-load-failed': |
| 316 | return `Marketplace ${error.marketplace} failed to load: ${error.reason}` |
| 317 | case 'mcp-config-invalid': |
| 318 | return `MCP server ${error.serverName} invalid: ${error.validationError}` |
| 319 | case 'mcp-server-suppressed-duplicate': { |
| 320 | const dup = error.duplicateOf.startsWith('plugin:') |
| 321 | ? `server provided by plugin "${error.duplicateOf.split(':')[1] ?? '?'}"` |
| 322 | : `already-configured "${error.duplicateOf}"` |
| 323 | return `MCP server "${error.serverName}" skipped — same command/URL as ${dup}` |
| 324 | } |
| 325 | case 'hook-load-failed': |
| 326 | return `Hook load failed: ${error.reason}` |
| 327 | case 'component-load-failed': |
| 328 | return `${error.component} load failed from ${error.path}: ${error.reason}` |
| 329 | case 'mcpb-download-failed': |
| 330 | return `Failed to download MCPB from ${error.url}: ${error.reason}` |
| 331 | case 'mcpb-extract-failed': |
| 332 | return `Failed to extract MCPB ${error.mcpbPath}: ${error.reason}` |
| 333 | case 'mcpb-invalid-manifest': |
| 334 | return `MCPB manifest invalid at ${error.mcpbPath}: ${error.validationError}` |
| 335 | case 'lsp-config-invalid': |
| 336 | return `Plugin "${error.plugin}" has invalid LSP server config for "${error.serverName}": ${error.validationError}` |
| 337 | case 'lsp-server-start-failed': |
| 338 | return `Plugin "${error.plugin}" failed to start LSP server "${error.serverName}": ${error.reason}` |
| 339 | case 'lsp-server-crashed': |
| 340 | if (error.signal) { |
| 341 | return `Plugin "${error.plugin}" LSP server "${error.serverName}" crashed with signal ${error.signal}` |
| 342 | } |
| 343 | return `Plugin "${error.plugin}" LSP server "${error.serverName}" crashed with exit code ${error.exitCode ?? 'unknown'}` |
| 344 | case 'lsp-request-timeout': |
| 345 | return `Plugin "${error.plugin}" LSP server "${error.serverName}" timed out on ${error.method} request after ${error.timeoutMs}ms` |
| 346 | case 'lsp-request-failed': |
| 347 | return `Plugin "${error.plugin}" LSP server "${error.serverName}" ${error.method} request failed: ${error.error}` |
| 348 | case 'marketplace-blocked-by-policy': |
| 349 | if (error.blockedByBlocklist) { |
| 350 | return `Marketplace '${error.marketplace}' is blocked by enterprise policy` |
| 351 | } |
| 352 | return `Marketplace '${error.marketplace}' is not in the allowed marketplace list` |
no outgoing calls
no test coverage detected