diff --git a/lib/connection.ts b/lib/connection.ts index 92b6d9b..6e41462 100644 --- a/lib/connection.ts +++ b/lib/connection.ts @@ -242,7 +242,7 @@ export class Connection extends Entity { onClose = (context: RheaEventContext) => { removeListeners(); - const err = context.error || context.connection.error; + const err = context.error || context.connection.error || Error('Failed to connect'); log.error("[%s] Error occurred while establishing amqp connection: %O", this.id, err); return reject(err);