fix(server): auto-reconnect to database (#12320)

This commit is contained in:
Jason Rasmussen 2024-09-04 13:32:43 -04:00 committed by GitHub
parent 1783dfd393
commit 12b65e3c24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 130 additions and 46 deletions

View file

@ -9,6 +9,7 @@ import {
} from '@nestjs/common';
import { Observable, catchError, throwError } from 'rxjs';
import { ILoggerRepository } from 'src/interfaces/logger.interface';
import { logGlobalError } from 'src/utils/logger';
import { routeToErrorMessage } from 'src/utils/misc';
@Injectable()
@ -25,9 +26,10 @@ export class ErrorInterceptor implements NestInterceptor {
return error;
}
const errorMessage = routeToErrorMessage(context.getHandler().name);
this.logger.error(errorMessage, error, error?.errors, error?.stack);
return new InternalServerErrorException(errorMessage);
logGlobalError(this.logger, error);
const message = routeToErrorMessage(context.getHandler().name);
return new InternalServerErrorException(message);
}),
),
);