Skip to content
Merged
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
Prev Previous commit
fixup! add undefined check
  • Loading branch information
debadree25 committed Feb 6, 2023
commit f106f87bfe5b64f15c37e44d1161b0fab688a3d4
3 changes: 3 additions & 0 deletions lib/internal/abort_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,9 @@ function transferableAbortController() {
* @returns {Promise<void>}
*/
async function aborted(signal, resource) {
if (signal === undefined) {
throw new ERR_INVALID_ARG_TYPE('signal', 'AbortSignal', signal);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have added this check since turns out changing the condition in validateAbortSignal() immediately results in the build breaking, so i assume its probably not a bug but would like a review here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like a common pattern across to the codebase to check for undefined and then validate the signal so i think its probably fine?

}
validateAbortSignal(signal, 'signal');
validateObject(resource, 'resource', { nullable: false, allowFunction: true, allowArray: true });
Comment thread
debadree25 marked this conversation as resolved.
Resolved
if (signal.aborted)
Expand Down