ACNA-3570: Append x-request-id header to error if present#121
ACNA-3570: Append x-request-id header to error if present#121hannah-taub-1 merged 3 commits intomasterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This pull request adds functionality to include response headers in error messages generated by the reduceError helper function. This enhancement provides additional debugging context when API calls fail by exposing header information that may be relevant for troubleshooting.
Changes:
- Modified
reduceErrorfunction to append response headers to error messages when present - Added test case to verify headers are included in error output
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/helpers.js | Updated reduceError function to append stringified headers to error message |
| test/helpers.test.js | Added test case verifying header inclusion in error message output |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Actually the JIRA issue specifically required to include only specific headers, not all headers. We only need the Console API's request id (not sure which, this needs to be determined through experimentation). We can't play whack-a-mole with filtering headers if the Console API changes in the future to include new sensitive headers - so this approach should not be used. I propose only an allowlist of headers to show: only the request id for now. |
|
The JIRA ticket mentioned x-request-id, but also said "other relevant headers". Are there any other headers I should add beyond x-request-id? |
Let's just add that 1 specific header for now. |
Description
If an error object has headers, append these headers to the error message returned by
reduceError.Related Issue
https://jira.corp.adobe.com/browse/ACNA-3570
Motivation and Context
How Has This Been Tested?
Created a local script that called
sdk.init()with invalid credentials and checked that headers appeared in the error message. Updated unit tests to check for header error output.Screenshots (if appropriate):
Types of changes
Checklist: