Skip to content

feat(sdk): include request URL in API error results#484

Open
jdalton wants to merge 1 commit intomainfrom
feat/include-url-in-api-errors
Open

feat(sdk): include request URL in API error results#484
jdalton wants to merge 1 commit intomainfrom
feat/include-url-in-api-errors

Conversation

@jdalton
Copy link
Contributor

@jdalton jdalton commented Feb 25, 2026

Summary

  • Add URL tracking to error handling for better debugging experience
  • Add url property to ResponseError class
  • Add url field to SocketSdkErrorResult and SocketSdkGenericResult types
  • Pass URL when throwing ResponseError in all relevant locations
  • Include URL in #handleApiError result output

This enables consumers (like socket-cli) to surface complete error details including the endpoint that failed, e.g.:

Socket API POST request failed (400): Bad Request
url: https://api.socket.dev/v0/orgs/badorg/full-scans

Also fixes Node 22 ESM/CJS interop issue with httpGetJson import in generate-sdk.mjs.

Test plan

  • Build passes
  • All 484 tests pass
  • TypeScript type check passes
  • ESLint passes

Based on #483 (merged to v1.4.x), adapted for v3 architecture.

Add URL tracking to error handling to improve debugging:
- Add `url` property to ResponseError class
- Add `url` field to SocketSdkErrorResult and SocketSdkGenericResult types
- Pass URL when throwing ResponseError in all relevant locations
- Include URL in #handleApiError result output

This enables consumers (like socket-cli) to surface complete error
details including the endpoint that failed.

Also fixes Node 22 ESM/CJS interop issue with httpGetJson import in
generate-sdk.mjs.
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