MCPcopy Index your code
hub / github.com/garrytan/gstack / normalizePortError

Function normalizePortError

browse/src/server.ts:795–802  ·  view source on GitHub ↗
(err: unknown)

Source from the content-addressed store, hash-verified

793const RANDOM_PORT_RETRIES = 5;
794
795function normalizePortError(err: unknown): Extract<PortCheckResult, { available: false }> {
796 const maybeNodeError = err as NodeJS.ErrnoException | undefined;
797 return {
798 available: false,
799 code: maybeNodeError?.code,
800 message: maybeNodeError?.message || String(err),
801 };
802}
803
804function isOccupiedPort(result: Extract<PortCheckResult, { available: false }>): boolean {
805 return result.code === 'EADDRINUSE';

Callers 1

checkPortAvailableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected