• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Flags: --expose-internals
2'use strict';
3require('../common');
4const assert = require('assert');
5const { uvException, uvExceptionWithHostPort } = require('internal/errors');
6
7{
8  const exception = uvException({ errno: 100, syscall: 'open' });
9
10  assert.strictEqual(exception.message, 'UNKNOWN: unknown error, open');
11  assert.strictEqual(exception.errno, 100);
12  assert.strictEqual(exception.syscall, 'open');
13  assert.strictEqual(exception.code, 'UNKNOWN');
14}
15
16{
17  const exception = uvExceptionWithHostPort(100, 'listen', '127.0.0.1', 80);
18
19  assert.strictEqual(exception.message,
20                     'listen UNKNOWN: unknown error 127.0.0.1:80');
21  assert.strictEqual(exception.code, 'UNKNOWN');
22  assert.strictEqual(exception.errno, 100);
23  assert.strictEqual(exception.syscall, 'listen');
24  assert.strictEqual(exception.address, '127.0.0.1');
25  assert.strictEqual(exception.port, 80);
26}
27