@nxtedition/nxt-undici 4.2.19 → 4.2.20
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.
|
@@ -91,15 +91,41 @@ class Handler extends DecoratorHandler {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
#decorateError(err) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
94
|
+
try {
|
|
95
|
+
err.url ??= new URL(this.#opts.path, this.#opts.origin).href
|
|
96
|
+
|
|
97
|
+
err.req = {
|
|
98
|
+
method: this.#opts?.method,
|
|
99
|
+
headers: this.#opts?.headers,
|
|
100
|
+
body:
|
|
101
|
+
// TODO (fix): JSON.stringify POJO
|
|
102
|
+
typeof this.#opts?.body !== 'string' || this.#opts.body.length > 1024
|
|
103
|
+
? undefined
|
|
104
|
+
: this.#opts.body,
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
err.res = {
|
|
108
|
+
headers: this.#headers,
|
|
109
|
+
// TODO (fix): JSON.stringify POJO
|
|
110
|
+
body: typeof this.#body !== 'string' || this.#body.length < 1024 ? undefined : this.#body,
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (this.#body) {
|
|
114
|
+
if (this.#body.reason != null) {
|
|
115
|
+
err.reason ??= this.#body.reason
|
|
116
|
+
}
|
|
117
|
+
if (this.#body.code != null) {
|
|
118
|
+
err.code ??= this.#body.code
|
|
119
|
+
}
|
|
120
|
+
if (this.#body.error != null) {
|
|
121
|
+
err.error ??= this.#body.errorq
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return err
|
|
126
|
+
} catch {
|
|
127
|
+
return err
|
|
128
|
+
}
|
|
103
129
|
}
|
|
104
130
|
}
|
|
105
131
|
|