11cb0ef41Sopenharmony_ci// Flags: --expose-internals 21cb0ef41Sopenharmony_ci'use strict'; 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_cirequire('../common'); 51cb0ef41Sopenharmony_ciconst { strictEqual, throws } = require('assert'); 61cb0ef41Sopenharmony_ciconst { NghttpError } = require('internal/http2/util'); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_cithrows(() => { 91cb0ef41Sopenharmony_ci const err = new NghttpError(-501); 101cb0ef41Sopenharmony_ci strictEqual(err.errno, -501); 111cb0ef41Sopenharmony_ci throw err; 121cb0ef41Sopenharmony_ci}, { 131cb0ef41Sopenharmony_ci code: 'ERR_HTTP2_ERROR', 141cb0ef41Sopenharmony_ci constructor: NghttpError, 151cb0ef41Sopenharmony_ci message: 'Invalid argument' 161cb0ef41Sopenharmony_ci}); 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ci// Should convert the NghttpError object to string properly 191cb0ef41Sopenharmony_ci{ 201cb0ef41Sopenharmony_ci const err = new NghttpError(401); 211cb0ef41Sopenharmony_ci strictEqual(err.toString(), 'Error [ERR_HTTP2_ERROR]: Unknown error code'); 221cb0ef41Sopenharmony_ci} 23