chore: add better logging to login and register routes
Some checks are pending
Build and Publish Docker Image / build-publish (push) Waiting to run

This commit is contained in:
William Oldham 2025-04-08 00:28:56 +01:00
parent 008a517947
commit dc5b885e0f
2 changed files with 9 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import { getPNIDByUsername, getPNIDByAPIRefreshToken } from '@/database';
import { nintendoPasswordHash, generateOAuthTokens} from '@/util';
import { HydratedPNIDDocument } from '@/types/mongoose/pnid';
import { SystemType } from '@/types/common/token';
import { LOG_ERROR } from '@/logger';
const router = express.Router();
@ -118,7 +119,10 @@ router.post('/', async (request: express.Request, response: express.Response): P
expires_in: tokenGeneration.expiresInSecs.access,
refresh_token: tokenGeneration.refreshToken
});
} catch {
} catch (error: any) {
LOG_ERROR('/v1/login - token generation: ' + error);
if (error.stack) console.error(error.stack);
response.status(500).json({
app: 'api',
status: 500,

View File

@ -376,7 +376,10 @@ router.post('/', async (request: express.Request, response: express.Response): P
expires_in: tokenGeneration.expiresInSecs.access,
refresh_token: tokenGeneration.refreshToken
});
} catch {
} catch (error: any) {
LOG_ERROR('/v1/register - token generation: ' + error);
if (error.stack) console.error(error.stack);
response.status(500).json({
app: 'api',
status: 500,