Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Erreke opened this issue Mar 20, 2019 · 0 comments
Open

Comments

@Erreke
Copy link

Erreke commented Mar 20, 2019

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant