also another important one, I've been getting a re...
# general
s
also another important one, I've been getting a response of 'Session Revoked, Please Login' sometimes when I try to /refreshSession with correct details which isnt supposed to happen. This is my function, is there anything wrong with it?
Copy code
export const attemptRefreshSession = async (req: Request, res: Response) => {
  try {
    const session: Session = await refreshSession(req, res);

    if (!session) {
      throw new Unauthorized();
    }
    return env !== 'development' ? true : developmentCookieResponse(res);
  } catch (err) {
    const authError = Error.isErrorFromAuth(err);

    if (authError && err.errType === Error.UNAUTHORISED) {
      return res.status(440).send({ mustLogin: true, message: 'Unauthorized. Please Login.' });
    }
    if (authError && err.errType !== Error.GENERAL_ERROR) {
      console.log(err, err.errType); // TODO remove
      const sessionHandle = err?.err?.sessionHandle;
      const successfulRevoke = await revokeSessionUsingSessionHandle(sessionHandle);
      return res
        .status(440)
        .send({ mustLogin: true, message: 'Session Revoked. Please Login.', successfulRevoke });
    }
    throw createHttpError(500, { err });
  }
};