Files
twenty_crm/packages/twenty-server/src/command/command.ts
Thomas Trompette c60a3e49cd Catch query timeout exceptions (#5680)
Query read timeouts happen when a remote server is not available. It
breaks:
- the remote server show page
- the record table page of imported remote tables

This PR will catch the exception so it does not go to Sentry in both
cases.

Also did 2 renaming.
2024-05-31 10:39:35 +02:00

36 lines
1.0 KiB
TypeScript

import { CommandFactory } from 'nest-commander';
import { shouldFilterException } from 'src/engine/utils/global-exception-handler.util';
import { ExceptionHandlerService } from 'src/engine/integrations/exception-handler/exception-handler.service';
import { LoggerService } from 'src/engine/integrations/logger/logger.service';
import { CommandModule } from './command.module';
async function bootstrap() {
const errorHandler = (err: Error) => {
loggerService.error(err?.message, err?.name);
if (shouldFilterException(err)) {
return;
}
exceptionHandlerService.captureExceptions([err]);
};
const app = await CommandFactory.createWithoutRunning(CommandModule, {
bufferLogs: process.env.LOGGER_IS_BUFFER_ENABLED === 'true',
errorHandler,
serviceErrorHandler: errorHandler,
});
const loggerService = app.get(LoggerService);
const exceptionHandlerService = app.get(ExceptionHandlerService);
// Inject our logger
app.useLogger(loggerService);
await CommandFactory.runApplication(app);
app.close();
}
bootstrap();