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_ciReflect.defineProperty(Error, 'stackTraceLimit', { 81cb0ef41Sopenharmony_ci writable: false, 91cb0ef41Sopenharmony_ci value: Error.stackTraceLimit, 101cb0ef41Sopenharmony_ci}); 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ciE('ERR_TEST', 'custom message', SystemError); 131cb0ef41Sopenharmony_ciconst { ERR_TEST } = codes; 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ciconst ctx = { 161cb0ef41Sopenharmony_ci code: 'ETEST', 171cb0ef41Sopenharmony_ci message: 'code message', 181cb0ef41Sopenharmony_ci syscall: 'syscall_test', 191cb0ef41Sopenharmony_ci path: '/str', 201cb0ef41Sopenharmony_ci dest: '/str2' 211cb0ef41Sopenharmony_ci}; 221cb0ef41Sopenharmony_ciassert.throws( 231cb0ef41Sopenharmony_ci () => { throw new ERR_TEST(ctx); }, 241cb0ef41Sopenharmony_ci { 251cb0ef41Sopenharmony_ci code: 'ERR_TEST', 261cb0ef41Sopenharmony_ci name: 'SystemError', 271cb0ef41Sopenharmony_ci info: ctx, 281cb0ef41Sopenharmony_ci } 291cb0ef41Sopenharmony_ci); 30