🐛 fix(api): return null on error so read handlers surface tidy errors + add CI#1
Merged
Merged
Conversation
Move try/catch from individual callers into apiFetch, which now returns null on any HTTP or network error and logs via console.error. Removes BugzillaError class. Callers (createBug, updateBug, createComment, createAttachment) are simplified to null-check the return value. Adds CI workflow running typecheck, build, and test on push/PR to main.
kud
marked this pull request as ready for review
July 5, 2026 01:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Aligns
apiFetchwith the fleet convention (as inmcp-trakt): it now returnsnullon non-ok HTTP responses and network errors — logging the status/body to stderr — instead of throwing aBugzillaError.Why
Only the four write handlers (
createBug,updateBug,createComment,createAttachment) wrappedapiFetchin try/catch. The thirteen read/tag handlers called it bare, so any API error (404, 401, 500, network) escaped the tool boundary as an unhandled throw instead of a tidyError: …message to the MCP client.Every handler was already written for the fail-soft contract (
const data = await apiFetch(...); return data ? ok(...) : err(...)), so the correct fix is to makeapiFetchhonour that contract rather than sprinkle thirteen more try/catch blocks.Changes
apiFetchreturnsnullon error (logs detail to stderr); the unusedBugzillaErrorclass is removed.ok/err..github/workflows/ci.ymlrunning typecheck + build + test on PRs and pushes tomain.Verification
npm run typecheckclean;npm test→ 42/42 pass (the 20 previously-failing error-path tests now pass against the fixed contract).