11cb0ef41Sopenharmony_ci// Flags: --expose-internals 21cb0ef41Sopenharmony_ci'use strict'; 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_cirequire('../common'); 51cb0ef41Sopenharmony_ciconst { 61cb0ef41Sopenharmony_ci strictEqual, 71cb0ef41Sopenharmony_ci throws, 81cb0ef41Sopenharmony_ci} = require('assert'); 91cb0ef41Sopenharmony_ciconst { AbortError } = require('internal/errors'); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci{ 121cb0ef41Sopenharmony_ci const err = new AbortError(); 131cb0ef41Sopenharmony_ci strictEqual(err.message, 'The operation was aborted'); 141cb0ef41Sopenharmony_ci strictEqual(err.cause, undefined); 151cb0ef41Sopenharmony_ci} 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ci{ 181cb0ef41Sopenharmony_ci const cause = new Error('boom'); 191cb0ef41Sopenharmony_ci const err = new AbortError('bang', { cause }); 201cb0ef41Sopenharmony_ci strictEqual(err.message, 'bang'); 211cb0ef41Sopenharmony_ci strictEqual(err.cause, cause); 221cb0ef41Sopenharmony_ci} 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ci{ 251cb0ef41Sopenharmony_ci throws(() => new AbortError('', false), { 261cb0ef41Sopenharmony_ci code: 'ERR_INVALID_ARG_TYPE' 271cb0ef41Sopenharmony_ci }); 281cb0ef41Sopenharmony_ci throws(() => new AbortError('', ''), { 291cb0ef41Sopenharmony_ci code: 'ERR_INVALID_ARG_TYPE' 301cb0ef41Sopenharmony_ci }); 311cb0ef41Sopenharmony_ci} 32