feat: add structured error logging for failed API fetches (Closes #949) - #1032
Open
waterWang wants to merge 1 commit into
Open
feat: add structured error logging for failed API fetches (Closes #949)#1032waterWang wants to merge 1 commit into
waterWang wants to merge 1 commit into
Conversation
Add logError calls to the apiFetch function to capture failed requests with the request path, HTTP status, and error message. This helps debugging production issues by surfacing structured, machine-readable log output for every failed API call. Changes: - src/api/client.ts: import logError and emit on network failures (status 0) and non-2xx responses - src/api/client.test.ts: 3 new tests covering non-2xx logging, network-error logging, and the no-log-on-success path Closes CredenceOrg#949
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
Add structured calls to the function so every failed API request is captured with the request path, HTTP status, and error message in a machine-readable key=value format.
Changes
Verification
event=api_fetch_failed path=/bonds status=404 error=Bond not found)Closes #949