use appError on socket io

This commit is contained in:
canove
2020-09-20 10:52:05 -03:00
parent b7484afd63
commit aa6f116514
2 changed files with 112 additions and 111 deletions

View File

@@ -1,5 +1,6 @@
import socketIo, { Server as SocketIO } from "socket.io";
import { Server } from "http";
import AppError from "../errors/AppError";
let io: SocketIO;
@@ -9,7 +10,7 @@ export const initIO = (httpServer: Server): SocketIO => {
};
export const getIO = (): SocketIO => {
if (!io) {
throw new Error("Socket IO not initialized");
throw new AppError("Socket IO not initialized");
}
return io;
};