fix: Use correct error type when token is missing
This commit is contained in:
@@ -4,6 +4,7 @@ import cookie from "cookie";
|
||||
import Koa from "koa";
|
||||
import IO from "socket.io";
|
||||
import { createAdapter } from "socket.io-redis";
|
||||
import { AuthenticationError } from "@server/errors";
|
||||
import Logger from "@server/logging/Logger";
|
||||
import Metrics from "@server/logging/Metrics";
|
||||
import * as Tracing from "@server/logging/tracer";
|
||||
@@ -207,7 +208,7 @@ async function authenticate(socket: SocketWithAuth) {
|
||||
const { accessToken } = cookies;
|
||||
|
||||
if (!accessToken) {
|
||||
throw new Error("No access token");
|
||||
throw AuthenticationError("No access token");
|
||||
}
|
||||
|
||||
const user = await getUserForJWT(accessToken);
|
||||
|
||||
Reference in New Issue
Block a user