| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 67124ac commit 01e8c15
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,7 +34,7 @@ module.exports.addAbortSignalNoValidate = function(signal, stream) { | |||
| 34 | 34 | return stream; | |
| 35 | 35 | } | |
| 36 | 36 | const onAbort = () => { | |
| 37 | - stream.destroy(new AbortError()); | ||
| 37 | + stream.destroy(new AbortError(undefined, { cause: signal.reason })); | ||
| 38 | 38 | }; | |
| 39 | 39 | if (signal.aborted) { | |
| 40 | 40 | onAbort(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -214,7 +214,8 @@ function fromAsyncGen(fn) { | |||
| 214 | 214 | const { chunk, done, cb } = await _promise; | |
| 215 | 215 | process.nextTick(cb); | |
| 216 | 216 | if (done) return; | |
| 217 | - if (signal.aborted) throw new AbortError(); | ||
| 217 | + if (signal.aborted) | ||
| 218 | + throw new AbortError(undefined, { cause: signal.reason }); | ||
| 218 | 219 | ({ promise, resolve } = createDeferredPromise()); | |
| 219 | 220 | yield chunk; | |
| 220 | 221 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -215,7 +215,9 @@ function eos(stream, options, callback) { | |||
| 215 | 215 | // Keep it because cleanup removes it. | |
| 216 | 216 | const endCallback = callback; | |
| 217 | 217 | cleanup(); | |
| 218 | - endCallback.call(stream, new AbortError()); | ||
| 218 | + endCallback.call( | ||
| 219 | + stream, | ||
| 220 | + new AbortError(undefined, { cause: options.signal.reason })); | ||
| 219 | 221 | }; | |
| 220 | 222 | if (options.signal.aborted) { | |
| 221 | 223 | process.nextTick(abort); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -122,8 +122,7 @@ function newWritableStreamFromStreamWritable(streamWritable) { | |||
| 122 | 122 | ||
| 123 | 123 | const cleanup = finished(streamWritable, (error) => { | |
| 124 | 124 | if (error?.code === 'ERR_STREAM_PREMATURE_CLOSE') { | |
| 125 | - const err = new AbortError(); | ||
| 126 | - err.cause = error; | ||
| 125 | + const err = new AbortError(undefined, { cause: error }); | ||
| 127 | 126 | error = err; | |
| 128 | 127 | } | |
| 129 | 128 | ||
@@ -403,8 +402,7 @@ function newReadableStreamFromStreamReadable(streamReadable) { | |||
| 403 | 402 | ||
| 404 | 403 | const cleanup = finished(streamReadable, (error) => { | |
| 405 | 404 | if (error?.code === 'ERR_STREAM_PREMATURE_CLOSE') { | |
| 406 | - const err = new AbortError(); | ||
| 407 | - err.cause = error; | ||
| 405 | + const err = new AbortError(undefined, { cause: error }); | ||
| 408 | 406 | error = err; | |
| 409 | 407 | } | |
| 410 | 408 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments