mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 15:35:41 +00:00

PR-URL: https://github.com/nodejs/node/pull/27506 Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
23 lines
557 B
JavaScript
23 lines
557 B
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
const { strictEqual } = require('assert');
|
|
const { NghttpError } = require('internal/http2/util');
|
|
|
|
common.expectsError(() => {
|
|
const err = new NghttpError(-501);
|
|
strictEqual(err.errno, -501);
|
|
throw err;
|
|
}, {
|
|
code: 'ERR_HTTP2_ERROR',
|
|
type: NghttpError,
|
|
message: 'Invalid argument'
|
|
});
|
|
|
|
// Should convert the NghttpError object to string properly
|
|
{
|
|
const err = new NghttpError(401);
|
|
strictEqual(err.toString(), 'Error [ERR_HTTP2_ERROR]: Unknown error code');
|
|
}
|