fix(server): connection aborted logging (#5595)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user