Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[_]: feature/Move access error log #463

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions src/app/routes/auth.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { Router, Request, Response } from 'express';
import createHttpError from 'http-errors';
import { Request, Response, Router } from 'express';
import createHttpError, { HttpError } from 'http-errors';
import speakeasy from 'speakeasy';
import { UserAttributes } from '../models/user';
import { passportAuth, Sign, SignNewToken } from '../middleware/passport';
import winston from 'winston';
import Config from '../../config/config';
import { AuthorizedUser } from './types';
import { HttpError } from 'http-errors';
import Logger from '../../lib/logger';
import winston from 'winston';
import { passportAuth, Sign, SignNewToken } from '../middleware/passport';
import { UserAttributes } from '../models/user';
import { ReferralsNotAvailableError } from '../services/errors/referrals';
import { AuthorizedUser } from './types';

interface Services {
User: any;
Expand Down Expand Up @@ -198,9 +197,9 @@ export class AuthController {
},
kyber: {
privateKey: null,
publicKey: null
}
},
publicKey: null,
},
},
bucket: userBucket,
registerCompleted: userData.registerCompleted,
teams: false,
Expand Down Expand Up @@ -254,12 +253,12 @@ export default (router: Router, service: any, config: Config) => {
try {
await controller.access(req, res);
} catch (err) {
logger.error(`[AUTH/ACCESS]: ERROR for user ${req.body.email}: ${(err as Error).message}`);

if (err instanceof HttpError) {
return res.status(err.statusCode).send({ error: err.message, code: err.code });
}

logger.error(`[AUTH/ACCESS]: ERROR for user ${req.body.email}: ${(err as Error).message}`);

res.status(500).send({ error: 'Internal Server Error' });
}
});
Expand Down
Loading