feat: collect API request/response data in error reporter#201
Open
feat: collect API request/response data in error reporter#201
Conversation
When an ApiError is thrown, the error reporter now automatically extracts request URL, method, status code, and response body from the error and includes them in telemetry. This removes the unused manual ErrorContext.api field in favor of auto-extraction from ApiError instances in buildProperties. https://claude.ai/code/session_01WsgRcUXSBY5v1TppPoDdwZ
Contributor
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/cli@0.0.28-pr.201.a10748cPrefer not to change any import paths? Install using npm alias so your code still imports npm i "base44@npm:@base44-preview/cli@0.0.28-pr.201.a10748c"Or add it to your {
"dependencies": {
"base44": "npm:@base44-preview/cli@0.0.28-pr.201.a10748c"
}
}
Preview published to npm registry — try new features instantly! |
Code ReviewI found one issue that should be addressed: Missing CLAUDE.md Documentation UpdateFile: This PR adds automatic extraction of API request/response data from
Why this matters:
Suggested fix: - API error details (automatically extracted from ApiError instances):
- Request URL and HTTP method
- Response status code
- Response bodySummary: 1 issue found related to CLAUDE.md adherence. No bugs detected in the implementation. |
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.
Note
Description
This PR improves API error telemetry by automatically capturing request and response details when
ApiErroris thrown. The error reporter now extracts the HTTP method, URL, status code, and response body directly fromApiErrorinstances, eliminating the need for manual context setting. This provides richer debugging information for API failures without requiring changes to existing error-throwing code.Related Issue
Fixes #185
Type of Change
Changes Made
ApiErrorclass to store request metadata (requestUrl,requestMethod) andresponseBodyApiError.fromHttpError()to extract and store request/response data from HTTP errorsErrorReporter.buildProperties()to automatically extract API data fromApiErrorinstancesErrorContext.apifield in favor of automatic extractiondetails,traceback,extra_data)ApiErrorproperties and extraction logic (77 new test lines)Testing
bun test)Checklist
Additional Notes
This change is backwards-compatible and improves observability for API errors without requiring any changes to existing error handling code. The telemetry now automatically includes
api_request_url,api_request_method,api_status_code, andapi_response_bodyproperties when anApiErroris captured.Documentation Update: The CLAUDE.md "What's Captured" section should be updated to reflect the new API error fields that are automatically captured from
ApiErrorinstances.🤖 Generated by Claude | 2026-02-07 23:40 UTC