Skip to content

Commit f7957ca

Browse files
committed
Adjust aborted requests error suppression
1 parent 7513391 commit f7957ca

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/core/exception/exception.filter.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,15 @@ export class ExceptionFilter implements IExceptionFilter {
2424
) {}
2525

2626
async catch(exception: Error, args: ArgumentsHost) {
27-
if (exception && (exception as any).type === 'request.aborted') {
28-
this.logger.warning('Request aborted');
27+
// Ignore aborted requests
28+
if (
29+
(exception as any).code === 'ECONNRESET' ||
30+
// There is some false positive with @fastify/compress and aborted requests
31+
(exception as any).code === 'ERR_STREAM_PREMATURE_CLOSE'
32+
) {
33+
if (process.env.NODE_ENV !== 'production') {
34+
this.logger.warning('Request aborted');
35+
}
2936
return;
3037
}
3138

0 commit comments

Comments
 (0)