Skip to content

Commit ba5c64b

Browse files
addaleaxTrott
authored andcommitted
quic: use AbortController with correct name/message
On the web, `AbortError` is the error name, not the error message. Change the code to match that. PR-URL: #34763 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 9594b54 commit ba5c64b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/internal/quic/core.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ let warnedVerifyHostnameIdentity = false;
253253

254254
let DOMException;
255255

256-
const lazyDOMException = hideStackFrames((message) => {
256+
const lazyDOMException = hideStackFrames((message, name) => {
257257
if (DOMException === undefined)
258258
DOMException = internalBinding('messaging').DOMException;
259-
return new DOMException(message);
259+
return new DOMException(message, name);
260260
});
261261

262262
assert(process.versions.ngtcp2 !== undefined);
@@ -664,10 +664,10 @@ class QuicEndpoint {
664664
if (signal != null && !('aborted' in signal))
665665
throw new ERR_INVALID_ARG_TYPE('options.signal', 'AbortSignal', signal);
666666

667-
// If an AbotSignal was passed in, check to make sure it is not already
667+
// If an AbortSignal was passed in, check to make sure it is not already
668668
// aborted before we continue on to do any work.
669669
if (signal && signal.aborted)
670-
throw new lazyDOMException('AbortError');
670+
throw new lazyDOMException('The operation was aborted', 'AbortError');
671671

672672
state.state = kSocketPending;
673673

@@ -685,7 +685,7 @@ class QuicEndpoint {
685685
// while we were waiting.
686686
if (signal && signal.aborted) {
687687
state.state = kSocketUnbound;
688-
throw new lazyDOMException('AbortError');
688+
throw new lazyDOMException('The operation was aborted', 'AbortError');
689689
}
690690

691691
// From here on, any errors are fatal for the QuicEndpoint. Keep in
@@ -1064,7 +1064,7 @@ class QuicSocket extends EventEmitter {
10641064
// If an AbotSignal was passed in, check to make sure it is not already
10651065
// aborted before we continue on to do any work.
10661066
if (signal && signal.aborted)
1067-
throw new lazyDOMException('AbortError');
1067+
throw new lazyDOMException('The operation was aborted', 'AbortError');
10681068

10691069
state.state = kSocketPending;
10701070

@@ -1086,7 +1086,7 @@ class QuicSocket extends EventEmitter {
10861086
// Some number of endpoints may have successfully bound, while
10871087
// others have not
10881088
if (signal && signal.aborted)
1089-
throw lazyDOMException('AbortError');
1089+
throw lazyDOMException('The operation was aborted', 'AbortError');
10901090

10911091
state.state = kSocketBound;
10921092

0 commit comments

Comments
 (0)