fix: surface Graph API error body in GraphError#524
Merged
heyitsaamir merged 7 commits intomainfrom Apr 15, 2026
Merged
Conversation
AxiosErrors from Graph API calls only showed status codes, with the actual error body (code, message) hidden behind `[Object]`. Add a GraphError class that extracts and formats the response body for readable error messages. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a typed GraphError to surface Graph API response details when Axios-based calls fail, improving debuggability and enabling programmatic handling.
Changes:
- Introduced
GraphError(statusCode, code, body) and message formatting using Graph error payloads. - Wrapped
Client.call()in Axios-aware error handling to throwGraphErroron HTTP failures. - Added Jest coverage for standard and non-standard Graph error bodies.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/graph/src/index.ts | Adds GraphError and converts Axios response failures into GraphError from Client.call() |
| packages/graph/src/index.spec.ts | Adds tests asserting GraphError payload extraction and messaging |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Address review feedback: - Rename constructor param from `path` to `url` to match what's actually passed - Pass original AxiosError as `cause` to preserve stack/request metadata Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix import order (axios before @microsoft/teams.common) - Widen cause param from Error to unknown to match ErrorOptions - Use rejects matcher instead of try/catch+fail in tests Co-Authored-By: Claude <noreply@anthropic.com>
Jesperholmbergmsft
previously approved these changes
Apr 15, 2026
…ilds
The `import { isAxiosError } from 'axios'` pulled the entire axios lib
(including Node-only modules like stream, zlib) into the graph bundle,
breaking the tab example's Vite browser build. Replace with inline check.
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
This was referenced Apr 15, 2026
Merged
heyitsaamir
added a commit
that referenced
this pull request
Apr 16, 2026
## Summary - Merges all changes from `main` since v2.0.7 into `release` - Sets `version.json` to stable `2.0.8` ### What's included - **feat:** Sovereign cloud support (GCCH, DoD, China) (#500) - **feat:** Add missing endpoints — Paged Members, Meeting Notifications & client gaps (#516) - **feat:** Graceful stream cancellation on 403 (#513) - **feat:** GitHub issue analysis → Teams notification workflow (#517) - **fix:** Improve error message when app credentials are missing (#527) - **fix:** Surface Graph API error body in GraphError (#524) - **fix:** Resolve missing deps, broken JSON, type errors, and typos in CLI templates (#521) - **fix:** Drain entire queue per flush cycle (#520) - **fix:** Merge User-Agent headers when cloning HTTP client (#508) - Dependency bumps: hono, axios, vite, @hono/node-server ## Post-merge 1. Trigger the [release pipeline](https://dev.azure.com/DomoreexpGithub/Github_Pipelines/_build?definitionId=52&_a=summary) for `release` with **Public** publish type 2. Bump `version.json` on `main` to `2.0.9-preview.{height}` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
Summary
GraphErrorclass topackages/graphthat extracts the Graph API response body (error code + message) from AxiosErrorsClient.call()with error handling so Graph errors produce readable messages likeGraph GET /chats/.../messages failed (403): Insufficient privileges to complete the operation.instead of justAxiosError: Request failed with status code 403GraphErrorexposesstatusCode,code, and fullbodyfor programmatic error handlingTest plan
{ error: { code, message } }body