Skip to content

Commit

Permalink
error
Browse files Browse the repository at this point in the history
  • Loading branch information
Saransh Balyan committed Sep 10, 2024
1 parent 6d513ce commit 8512f1a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 3 additions & 1 deletion Utils/Logger/console.logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ const overrideConsole = () => {
export default overrideConsole;

const getFileNameFromError = (error) => {
const str = `[${error.stack.split('\n')[2].split('/').at(-1).replace(/\)/, '')}]${
let file = error.stack.split('\n')[2].split('/').at(-1).replace(/\)/, '');
if (file === 'error.js:3:11') file = error.stack.split('\n')[3].split('/').at(-1).replace(/\)/, '');
const str = `[${file}]${
Array(30).fill('\xa0').join('')}`;
return str.substring(0, 30);
};
15 changes: 8 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import '#utils/ApiError.js';
import parser from 'body-parser';
import express from 'express';
import fileupload from 'express-fileupload';
// Import { scheduleInit } from "#scheduler/Service/schedulerService.js";
import expressListRoutes from 'express-list-routes';
import helmet from 'helmet';

import defaultMiddleware from '#middlewares/default.middleware.js';
Expand All @@ -12,19 +14,18 @@ import morgalApiLogger from '#utils/Logger/api.logger.js';
import overrideConsole from '#utils/Logger/console.logger.js';
import { getTenantDB } from '#utils/Mongo/mongo.connection.js';
import registerRoutes from '#utils/registerRoutes.js';
// Import { scheduleInit } from "#scheduler/Service/schedulerService.js";

import expressListRoutes from 'express-list-routes';

const app = express();

app.use(defaultMiddleware());

overrideConsole();

// console.debug('======================ENV======================');
// console.debug(process.env);
// console.debug('======================ENV======================');
/*
* console.debug('======================ENV======================');
* console.debug(process.env);
* console.debug('======================ENV======================');
*/

await getTenantDB().then(() => seedSuperAdmin());

Expand All @@ -42,7 +43,7 @@ setupResponseInterceptor(app);

await registerRoutes(app);

expressListRoutes(app)
expressListRoutes(app);
setupValidationErrorInterceptor(app);

app.listen(process.env.PORT, () => {
Expand Down

0 comments on commit 8512f1a

Please sign in to comment.