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