fix(server): connection aborted logging (#5595)

This commit is contained in:
Jason Rasmussen
2023-12-09 21:46:56 -05:00
committed by GitHub
parent 3a794d7a2b
commit b7b4483a33
3 changed files with 21 additions and 13 deletions
@@ -8,6 +8,7 @@ import {
NestInterceptor,
} from '@nestjs/common';
import { Observable, catchError, throwError } from 'rxjs';
import { isConnectionAborted } from '../../domain';
import { routeToErrorMessage } from '../app.utils';
@Injectable()
@@ -20,7 +21,9 @@ export class ErrorInterceptor implements NestInterceptor {
throwError(() => {
if (error instanceof HttpException === false) {
const errorMessage = routeToErrorMessage(context.getHandler().name);
this.logger.error(errorMessage, error, error?.errors);
if (!isConnectionAborted(error)) {
this.logger.error(errorMessage, error, error?.errors);
}
return new InternalServerErrorException(errorMessage);
} else {
return error;