Skip to content

fix(fetchZyfiSponsored): enhance error handling and logging#118

Merged
Douglasacost merged 3 commits into
mainfrom
clk-gateway/error-logs
Jul 8, 2026
Merged

fix(fetchZyfiSponsored): enhance error handling and logging#118
Douglasacost merged 3 commits into
mainfrom
clk-gateway/error-logs

Conversation

@Douglasacost

@Douglasacost Douglasacost commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Centralizes ZyFi paymaster logging in fetchZyfiSponsored so every call site shares the same format.

Log level Format When
log ZyFi request [operation]: … Before each ZyFi API call
log ZyFi response [operation]: … On success
error ZyFi error [operation] {status} {statusText}: … On HTTP error (includes response body)

Call sites pass an operation label (register, set-text-record) instead of duplicating log statements. The legacy register route in index.ts is included for consistency.

Errors throw with the operation name and API message (or serialized body) for easier tracing in request logs.

Test plan

  • Trigger a ZyFi-sponsored register — confirm request/response logs appear with [register]
  • Trigger a ZyFi-sponsored set-text-record — confirm logs appear with [set-text-record]
  • Simulate a ZyFi API failure — confirm error log includes HTTP status and response body

Updated the fetchZyfiSponsored function to improve error handling by logging the response status and body when a fetch fails. This change provides clearer insights into the failure reasons. Additionally, adjusted the response parsing to use a single await for the response body, ensuring consistency in handling the response data.
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

LCOV of commit 6535249 during checks #746

Summary coverage rate:
  lines......: 27.1% (939 of 3463 lines)
  functions..: 27.5% (150 of 546 functions)
  branches...: 28.1% (164 of 583 branches)

Files changed coverage rate: n/a

aliXsed and others added 2 commits July 9, 2026 10:50
Move operation-tagged logging into fetchZyfiSponsored so all call sites
(register, set-text-record, legacy index route) share the same format and
error output includes HTTP status plus response body.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Douglasacost Douglasacost merged commit e1bb0a2 into main Jul 8, 2026
3 checks passed
@Douglasacost Douglasacost deleted the clk-gateway/error-logs branch July 8, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants