Skip to content

feat: add error handling, validation, timeout, and verbose mode#28

Merged
ryanio merged 1 commit intomainfrom
feat/error-handling-and-robustness
Feb 25, 2026
Merged

feat: add error handling, validation, timeout, and verbose mode#28
ryanio merged 1 commit intomainfrom
feat/error-handling-and-robustness

Conversation

@ryanio
Copy link
Collaborator

@ryanio ryanio commented Feb 25, 2026

Summary

  • Network error handling: CLI now catches TypeError (DNS/timeout/connection failures) and other non-API errors, outputting structured JSON to stderr instead of raw stack traces
  • NaN validation: New parseIntOption/parseFloatOption helpers replace all 21 raw Number.parseInt/Number.parseFloat calls across 8 command files — passing --limit abc now shows a clear error instead of silently sending NaN to the API
  • Empty object fix: formatTable({}) returns "(empty)" instead of crashing on Math.max(...[])
  • Fetch timeout: All fetch calls use AbortSignal.timeout() (default 30s), configurable via --timeout <ms> CLI option or timeout in SDK config
  • Verbose mode: --verbose flag logs [verbose] GET <url> and [verbose] 200 OK to stderr for debugging
  • Extended post() signature: Now accepts optional body and params arguments for SDK consumers
  • Cursor/next documentation: Inline comments explaining why tokens API uses cursor instead of next

Test plan

  • npm run test — 130 tests pass (was 115, +15 new)
  • npm run lint — Biome passes
  • npm run type-check — no TypeScript errors
  • Manual: opensea collections get boredapeyachtclub works
  • Manual: opensea collections get boredapeyachtclub --verbose shows request/response on stderr
  • Manual: opensea tokens trending --limit abc shows clear error instead of silent NaN
  • Manual: unplug network → opensea collections list shows structured JSON error, not stack trace

🤖 Generated with Claude Code


Open with Devin

- Handle network errors gracefully in CLI with structured JSON on stderr
- Add NaN-guarding parseIntOption/parseFloatOption helpers; replace all
  raw parseInt/parseFloat calls across 8 command files
- Fix empty object edge case in table formatter (Math.max on empty array)
- Add configurable fetch timeout (default 30s) with --timeout CLI option
- Add --verbose flag for request/response debugging on stderr
- Extend post() to accept optional body and query params
- Document cursor vs next parameter mapping in tokens API

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ryanio ryanio merged commit 73daf8e into main Feb 25, 2026
4 checks passed
@ryanio ryanio deleted the feat/error-handling-and-robustness branch February 25, 2026 19:43
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

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.

1 participant