fibercrypto / fibercrypto/skycoin

Logging error responses from v2 APIs should exclude "data"

Open
#2,180 0 comments 0 reactions 0 assignees View on GitHub
api
Dominant language
Go
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Description

When an API responds with an error, the response is logged.

For /v1 endpoints the response will be like "400 Bad Request - foo" but for /v2 endpoints the response will be a JSON object and may include a "data" section even if there is an error (e.g. /api/v2/transaction/verify).

For /v2 endpoints, log the "error"["message"] value instead of the entire response.
It should avoid re-parsing the JSON response just to get this message; restructuring is necessary to log this error message without reparsing.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the API error-response logging path and compare how /v1 responses with "400 Bad Request - foo" are handled with the JSON response from /api/v2/transaction/verify. The change is done when v2 logging records error.message instead of the full response, avoids reparsing the JSON, and preserves the existing v1 behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.