| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 232287f commit 2cfa96f
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,7 +25,7 @@ const { | |||
| 25 | 25 | ERR_INVALID_STATE, | |
| 26 | 26 | }, | |
| 27 | 27 | } = require('internal/errors'); | |
| 28 | - const { isError, lazyDOMException } = require('internal/util'); | ||
| 28 | + const { lazyDOMException } = require('internal/util'); | ||
| 29 | 29 | const { | |
| 30 | 30 | validateAbortSignal, | |
| 31 | 31 | validateInteger, | |
@@ -135,9 +135,7 @@ class PushQueue { | |||
| 135 | 135 | ||
| 136 | 136 | if (this.#signal) { | |
| 137 | 137 | this.#abortHandler = () => { | |
| 138 | - this.fail(isError(this.#signal.reason) ? | ||
| 139 | - this.#signal.reason : | ||
| 140 | - lazyDOMException('Aborted', 'AbortError')); | ||
| 138 | + this.fail(this.#signal.reason); | ||
| 141 | 139 | }; | |
| 142 | 140 | onSignalAbort(this.#signal, this.#abortHandler); | |
| 143 | 141 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -107,6 +107,16 @@ async function testAbortSignal() { | |||
| 107 | 107 | ); | |
| 108 | 108 | } | |
| 109 | 109 | ||
| 110 | + async function testAbortSignalReason() { | ||
| 111 | + const reason = 'test reason'; | ||
| 112 | + const ac = new AbortController(); | ||
| 113 | + const { writer } = push({ signal: ac.signal }); | ||
| 114 | + | ||
| 115 | + ac.abort(reason); | ||
| 116 | + | ||
| 117 | + await assert.rejects(writer.write('data'), (err) => err === reason); | ||
| 118 | + } | ||
| 119 | + | ||
| 110 | 120 | async function testPreAbortedSignal() { | |
| 111 | 121 | const { readable } = push({ signal: AbortSignal.abort() }); | |
| 112 | 122 | await assert.rejects(async () => { | |
@@ -172,6 +182,7 @@ Promise.all([ | |||
| 172 | 182 | testWriterFail(), | |
| 173 | 183 | testConsumerBreak(), | |
| 174 | 184 | testAbortSignal(), | |
| 185 | + testAbortSignalReason(), | ||
| 175 | 186 | testPreAbortedSignal(), | |
| 176 | 187 | testConsumerBreakWriteSyncReturnsFalse(), | |
| 177 | 188 | testPushWithTransforms(), | |
| Back | FazBrowse Home | New Git URL |
0 commit comments