xref: /third_party/node/test/parallel/test-http2-util-nghttp2error.js (revision 1cb0ef41)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
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

Indexes created Thu Nov 07 10:32:03 CST 2024