11cb0ef41Sopenharmony_ci// Flags: --expose-internals 21cb0ef41Sopenharmony_ci'use strict'; 31cb0ef41Sopenharmony_cirequire('../common'); 41cb0ef41Sopenharmony_ciconst assert = require('assert'); 51cb0ef41Sopenharmony_ciconst { E, SystemError, codes } = require('internal/errors'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_cidelete Error.stackTraceLimit; 81cb0ef41Sopenharmony_ciObject.seal(Error); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ciE('ERR_TEST', 'custom message', SystemError); 111cb0ef41Sopenharmony_ciconst { ERR_TEST } = codes; 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciconst ctx = { 141cb0ef41Sopenharmony_ci code: 'ETEST', 151cb0ef41Sopenharmony_ci message: 'code message', 161cb0ef41Sopenharmony_ci syscall: 'syscall_test', 171cb0ef41Sopenharmony_ci path: '/str', 181cb0ef41Sopenharmony_ci dest: '/str2' 191cb0ef41Sopenharmony_ci}; 201cb0ef41Sopenharmony_ciassert.throws( 211cb0ef41Sopenharmony_ci () => { throw new ERR_TEST(ctx); }, 221cb0ef41Sopenharmony_ci { 231cb0ef41Sopenharmony_ci code: 'ERR_TEST', 241cb0ef41Sopenharmony_ci name: 'SystemError', 251cb0ef41Sopenharmony_ci info: ctx, 261cb0ef41Sopenharmony_ci } 271cb0ef41Sopenharmony_ci); 28