MCPcopy Create free account
hub / github.com/MicrosoftDocs/mcp / isCommanderLikeError

Function isCommanderLikeError

cli/src/index.ts:85–92  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

83
84 const message = error instanceof Error ? error.message : String(error);
85 context.writeErr(`Error: ${message}\n`);
86 return 1;
87}
88
89function isCommanderLikeError(error: unknown): error is { exitCode: number; code?: string; message: string } {
90 if (!error || typeof error !== 'object') {
91 return false;
92 }
93
94 const maybeError = error as Record<string, unknown>;
95 return typeof maybeError.exitCode === 'number' && typeof maybeError.message === 'string';

Callers 1

handleCliErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected