diff --git a/lib/core/util.js b/lib/core/util.js index 5a28529b663..f7855c7256c 100644 --- a/lib/core/util.js +++ b/lib/core/util.js @@ -334,19 +334,11 @@ function isDisturbed (body) { } function isErrored (body) { - return !!(body && ( - stream.isErrored - ? stream.isErrored(body) - : /state: 'errored'/.test(nodeUtil.inspect(body) - ))) + return !!(body && stream.isErrored(body)) } function isReadable (body) { - return !!(body && ( - stream.isReadable - ? stream.isReadable(body) - : /state: 'readable'/.test(nodeUtil.inspect(body) - ))) + return !!(body && stream.isReadable(body)) } function getSocketInfo (socket) { @@ -417,10 +409,7 @@ function throwIfAborted (signal) { signal.throwIfAborted() } else { if (signal.aborted) { - // DOMException not available < v17.0.0 - const err = new Error('The operation was aborted') - err.name = 'AbortError' - throw err + throw new DOMException('The operation was aborted', 'AbortError') } } }