Skip to content

Commit

Permalink
quic: use AbortController with correct name/message
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
addaleax authored and Trott committed Aug 15, 2020
1 parent 9594b54 commit ba5c64b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/internal/quic/core.js
Expand Up @@ -253,10 +253,10 @@ let warnedVerifyHostnameIdentity = false;

let DOMException;

const lazyDOMException = hideStackFrames((message) => {
const lazyDOMException = hideStackFrames((message, name) => {
if (DOMException === undefined)
DOMException = internalBinding('messaging').DOMException;
return new DOMException(message);
return new DOMException(message, name);
});

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

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

state.state = kSocketPending;

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

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

state.state = kSocketPending;

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

state.state = kSocketBound;

Expand Down

0 comments on commit ba5c64b

Please sign in to comment.