Skip to content

connection.ping не реджектится, не заходит в catch #47

Open
@Erreke

Description

@Erreke

Хочу словить ошибку подключения к тарантулу, но не получается.
Есть такой код:

const TarantoolConnection = require('tarantool-driver');

const host = 'localhost';
const port = '3310';
const username = 'ykuandykov';
const password = '987654321';

const reserveHosts = [
	'ykuandykov:987654321@localhost:3313',
	'ykuandykov:987654321@localhost:3314',
];

const times = 1;
const timeOut = 100;

const connection = new TarantoolConnection({
	host,
	port,
	username,
	password,
	reserveHosts: reserveHosts,
	beforeReserve: times,
	lazyConnect: true,
	retryStrategy: () => timeOut,
});

connection.on('connect', config => {
	console.log('connecting config', config);
});

connection.on('reconnecting', timeout => {
	console.log('reconnecting timeout', timeout);
});

connection.ping()
	.then(result => {
		console.log('ping resolve result', result);
	},
	error => {
		console.log('ping reject error', error);
	})
	.catch(error => {
		console.log('ping catch error', error);
	});

И он выдает следующее:

[tarantool-driver] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:3310
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
reconnecting timeout 100
[tarantool-driver] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:3310
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
reconnecting timeout 100
[tarantool-driver] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:3313
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
reconnecting timeout 100
[tarantool-driver] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:3313
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
reconnecting timeout 100
connecting config { host: 'localhost', port: '3314' }
ping resolve result true

Ошибка пинга есть, но код не зашел ни в reject, ни в catch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions