@nxtedition/nxt-undici 6.1.5 → 6.1.6

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.
@@ -190,22 +190,26 @@ export default () => (dispatch) => (opts, handler) => {
190
190
  }
191
191
  }
192
192
 
193
- handler.onConnect(abort)
194
- if (aborted) {
195
- return
196
- }
197
-
198
- handler.onHeaders(statusCode, headers, NOOP)
199
- if (aborted) {
200
- return
201
- }
193
+ try {
194
+ handler.onConnect(abort)
195
+ if (aborted) {
196
+ return
197
+ }
202
198
 
203
- if (body?.byteLength) {
204
- handler.onData(body)
199
+ handler.onHeaders(statusCode, headers, NOOP)
205
200
  if (aborted) {
206
201
  return
207
202
  }
208
- }
209
203
 
210
- handler.onComplete({})
204
+ if (body?.byteLength) {
205
+ handler.onData(body)
206
+ if (aborted) {
207
+ return
208
+ }
209
+ }
210
+
211
+ handler.onComplete({})
212
+ } catch (err) {
213
+ abort(err)
214
+ }
211
215
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "6.1.5",
3
+ "version": "6.1.6",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",