From bb86f854651785ef82e9e230e665d631b3716104 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Wed, 1 Dec 2021 06:48:05 -0800 Subject: [PATCH] [squash] nit Co-authored-by: Antoine du Hamel --- lib/internal/errors.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 97e10d94348ef5..176a9e417d802a 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -821,14 +821,11 @@ function hideInternalStackFrames(error) { // to make usage of the error in userland and readable-stream easier. // It is a regular error with `.code` and `.name`. class AbortError extends Error { - constructor(message = 'The operation was aborted', options = {}) { - if (options === null || typeof options !== 'object') { + constructor(message = 'The operation was aborted', options = undefined) { + if (options !== undefined && typeof options !== 'object') { throw new codes.ERR_INVALID_ARG_TYPE('options', 'Object', options); } - const { - cause, - } = options; - super(message, { cause }); + super(message, options); this.code = 'ABORT_ERR'; this.name = 'AbortError'; }