Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to access Response Headers through RequestFailedException #221

Closed
rknikode opened this issue Apr 3, 2024 · 1 comment · Fixed by #246
Closed

Need to access Response Headers through RequestFailedException #221

rknikode opened this issue Apr 3, 2024 · 1 comment · Fixed by #246
Assignees
Labels
enhancement New feature or request

Comments

@rknikode
Copy link

rknikode commented Apr 3, 2024

Is your feature request related to a problem? Please describe.
When performing email account authorization with Nylas, if the request fails due to hitting the rate limit (status code 429), Nylas suggests implementing an exponential backoff strategy. However, the RequestFailedException thrown by Nylas does not provide access to the response headers, which contain valuable information such as the rate limit and reset time.

Describe the solution you'd like

  1. Modify the executeRequest method in the NylasClient class to capture and return the response headers along with the response body.
  2. Enhance the RequestFailedException class to include a field for storing the response headers.
  3. Pass the response headers to the RequestFailedException.parseErrorResponse method when creating a new instance of RequestFailedException.
  4. Provide getter methods in the RequestFailedException class to retrieve the response headers.
  5. Then we can utilize the response headers in the application code to implement the exponential backoff strategy based on the rate limit and reset time provided by Nylas.
@rknikode rknikode added the enhancement New feature or request label Apr 3, 2024
@mrashed-dev mrashed-dev self-assigned this May 31, 2024
@mrashed-dev
Copy link
Contributor

Thanks for opening this issue @rknikode, we will look into this and see if we can put these improvements on a roadmap. We will reply here when we have an update.

@mrashed-dev mrashed-dev linked a pull request Sep 25, 2024 that will close this issue
mrashed-dev added a commit that referenced this issue Sep 25, 2024
# Changelog
### Added
* Added new error class `NylasSdkRemoteClosedError` for when the remote
connection is closed (#244)
* Added support for new filter fields for listing events (#245)
* Added response headers to Nylas API error objects (#246, #221)

# License
<!-- Your PR comment must contain the following line for us to merge the
PR. -->
I confirm that this contribution is made under the terms of the MIT
license and that I have the authority necessary to make this
contribution on behalf of its copyright owner.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants