Skip to content

Commit b31c516

Browse files
whoabuddyclaude
andcommitted
fix(news): restore unreachable throw to satisfy TS narrowing
#432's "remove dead code" change deleted a post-loop throw that was unreachable at runtime but required for TypeScript to narrow the return type. Without it, the for-loop's normal exit path makes the function signature `Promise<{...} | undefined>`, which fails to match the MCP tool registration parameter type. Restored the throw with a comment explaining why it must stay even though it's "dead." Build clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ed60ec6 commit b31c516

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/tools/news.tools.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,13 @@ Fields:
833833
);
834834
}
835835

836-
836+
// Unreachable at runtime: the for-loop always exits via return (success)
837+
// or throw (non-retryable failure or final retry exhausted). Required to
838+
// satisfy TypeScript's narrowing — without it the function signature
839+
// allows `undefined` and the MCP tool registration fails to typecheck.
840+
throw new Error(
841+
`Signal filing failed after ${MAX_ATTEMPTS} attempts. Last error: ${lastError}`
842+
);
837843
} catch (error) {
838844
return createErrorResponse(error);
839845
}

0 commit comments

Comments
 (0)