Skip to content

TW-4937: surface API request ID in CLI error output#80

Merged
qasim-nylas merged 1 commit into
mainfrom
feature/TW-4937-surface-api-request-id
May 13, 2026
Merged

TW-4937: surface API request ID in CLI error output#80
qasim-nylas merged 1 commit into
mainfrom
feature/TW-4937-surface-api-request-id

Conversation

@qasim-nylas
Copy link
Copy Markdown
Collaborator

Summary

  • Extract request_id from Nylas API error responses (JSON body with header fallback) and propagate through APIErrorCLIErrorFormatError
  • Display request ID on a dedicated line in CLI error output, giving users an actionable reference for debugging with the platform team
  • Strip inline [request_id: ...] from the error message in FormatError path to avoid duplication while preserving it in Error() for logging contexts

Related docs

Commands affected by improved error output:

Commands referenced in error suggestions:

Test plan

  • make ci passes
  • NYLAS_API_KEY=bogus ./bin/nylas email list fake-grant-id shows Request ID: on its own line, not duplicated in the message
  • Errors without a request ID (e.g. local validation like nylas email list with no API key) show no Request ID: line
  • Unit tests cover: body extraction, header fallback, request ID propagation through WrapError, FormatError rendering, blank request ID omission, inline suffix stripping

Extract request_id from API error responses (body + header fallback)
and display it on a dedicated line in formatted CLI errors, giving
users an actionable reference for support and debugging.
@qasim-nylas qasim-nylas requested a review from AaronDDM May 13, 2026 16:04
Copy link
Copy Markdown
Collaborator

@AaronDDM AaronDDM left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@qasim-nylas qasim-nylas merged commit 945b2e6 into main May 13, 2026
6 checks passed
@qasim-nylas qasim-nylas deleted the feature/TW-4937-surface-api-request-id branch May 13, 2026 16:18
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