dd-trace 3.13.1 → 4.0.0-pre-e22d438
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -418,8 +418,13 @@ addHook({
|
|
|
418
418
|
|
|
419
419
|
// we store the original function, not to lose it
|
|
420
420
|
originalFns.set(newFn, this.fn)
|
|
421
|
-
|
|
422
421
|
this.fn = newFn
|
|
422
|
+
|
|
423
|
+
// Temporarily keep functionality when .asyncResource is removed from node
|
|
424
|
+
// in https://github.com/nodejs/node/pull/46432
|
|
425
|
+
if (!this.fn.asyncResource) {
|
|
426
|
+
this.fn.asyncResource = asyncResource
|
|
427
|
+
}
|
|
423
428
|
}
|
|
424
429
|
}
|
|
425
430
|
|
|
@@ -98,9 +98,16 @@ function request (data, options, callback) {
|
|
|
98
98
|
if (res.statusCode >= 200 && res.statusCode <= 299) {
|
|
99
99
|
callback(null, responseData, res.statusCode)
|
|
100
100
|
} else {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
let errorMessage = ''
|
|
102
|
+
try {
|
|
103
|
+
const fullUrl = new URL(
|
|
104
|
+
options.path,
|
|
105
|
+
options.url || options.hostname || `http://localhost:${options.port}`
|
|
106
|
+
).href
|
|
107
|
+
errorMessage = `Error from ${fullUrl}: ${res.statusCode} ${http.STATUS_CODES[res.statusCode]}.`
|
|
108
|
+
} catch (e) {
|
|
109
|
+
// ignore error
|
|
110
|
+
}
|
|
104
111
|
if (responseData) {
|
|
105
112
|
errorMessage += ` Response from the endpoint: "${responseData}"`
|
|
106
113
|
}
|