hpi-schul-cloud / gamification

A reusable microservice for gamification.
GNU Affero General Public License v3.0
44 stars 17 forks source link

find better error handling for AMQP connection #48

Closed sebastiankliem closed 6 years ago

sebastiankliem commented 6 years ago

In AmqpConnector.connect() the error handling causes unclear return behavior.

In case the connection fails the first time, the method returns a resolved empty promise. Callers of this method, however, expect the returned promise to only be resolved once the connection is successful. -- @cmfcmf in #44

...
} catch (error) {
console.warn(error);
console.log('RabbitMQ connection failed. Reconnecting in 1 s ...');
setTimeout(() => {
this.connect();
}, 1000);
}