Skip to content

Commit

Permalink
[squash] nit
Browse files Browse the repository at this point in the history
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
jasnell and aduh95 committed Dec 1, 2021
1 parent 5edb1d1 commit bb86f85
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/internal/errors.js
Expand Up @@ -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';
}
Expand Down

0 comments on commit bb86f85

Please sign in to comment.