aws / aws-xray-sdk-node

The official AWS X-Ray SDK for Node.js.
Apache License 2.0
266 stars 155 forks source link

aws-xray-sdk-fetch: fix subsegment callback error parameter type #644

Closed EdwardB120 closed 3 months ago

EdwardB120 commented 3 months ago

Issue #, if available:

N/A

Description of changes:

Error can be undefined when subSegmentCallback is called in this scenario, lines 119 to 121 in fetch_p.js.

if (thisSubsegmentCallback) {
    thisSubsegmentCallback(subsegment, requestClone, response);
}

These changes update the type from error: Error to error?: Error | undefined.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.