fix: Use correct error type when token is missing

This commit is contained in:
Tom Moor
2023-07-17 22:38:44 -04:00
parent 5206beaf19
commit d928d456de

View File

@@ -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);