mirror of
https://github.com/spacebarchat/server.git
synced 2026-05-25 14:15:02 +00:00
Try/catch in GetSafeChannel to maybe catch createchannel errors????
This commit is contained in:
+16
-11
@@ -54,19 +54,24 @@ export const RabbitMQ: {
|
||||
|
||||
if (this.channel) return this.channel;
|
||||
|
||||
this.channel = await this.connection.createChannel();
|
||||
console.log(`[RabbitMQ] channel created`);
|
||||
try {
|
||||
this.channel = await this.connection.createChannel();
|
||||
console.log(`[RabbitMQ] channel created`);
|
||||
|
||||
// log channel errors
|
||||
this.channel.on("error", (err) => {
|
||||
console.error("[RabbitMQ] Channel Error:", err);
|
||||
});
|
||||
// log channel errors
|
||||
this.channel.on("error", (err) => {
|
||||
console.error("[RabbitMQ] Channel Error:", err);
|
||||
});
|
||||
|
||||
this.channel.on("close", () => {
|
||||
console.log("[RabbitMQ] channel closed");
|
||||
this.channel = null;
|
||||
});
|
||||
this.channel.on("close", () => {
|
||||
console.log("[RabbitMQ] channel closed");
|
||||
this.channel = null;
|
||||
});
|
||||
|
||||
return this.channel;
|
||||
return this.channel;
|
||||
} catch (e) {
|
||||
console.error("[RabbitMQ] Failed to create channel:", e);
|
||||
return Promise.reject(e);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user