1// Flags: --expose-internals 2'use strict'; 3 4require('../common'); 5const { strictEqual, throws } = require('assert'); 6const { NghttpError } = require('internal/http2/util'); 7 8throws(() => { 9 const err = new NghttpError(-501); 10 strictEqual(err.errno, -501); 11 throw err; 12}, { 13 code: 'ERR_HTTP2_ERROR', 14 constructor: NghttpError, 15 message: 'Invalid argument' 16}); 17 18// Should convert the NghttpError object to string properly 19{ 20 const err = new NghttpError(401); 21 strictEqual(err.toString(), 'Error [ERR_HTTP2_ERROR]: Unknown error code'); 22} 23