Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
  • Loading branch information
addaleax committed Aug 14, 2020
commit 6a78fc735e956054fc4657e39892874f99ea0c94
14 changes: 7 additions & 7 deletions lib/internal/quic/core.js
Original file line number Diff line number Diff line change
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