Skip to content

Commit 8cea62a

Browse files
authored
Merge pull request #2789 from shubhamkumar9199/fix/client-image-404-logging
WEB-375-fix: suppress console logs for expected 404 client image requests
2 parents bdb5fc9 + 54f7dd1 commit 8cea62a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/app/core/http/error-handler.interceptor.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
33
import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest, HttpErrorResponse } from '@angular/common/http';
44

55
/** rxjs Imports */
6-
import { Observable } from 'rxjs';
6+
import { EMPTY, Observable } from 'rxjs';
77
import { catchError } from 'rxjs/operators';
88

99
/** Environment Configuration */
@@ -50,7 +50,9 @@ export class ErrorHandlerInterceptor implements HttpInterceptor {
5050
}
5151
}
5252

53-
if (!environment.production) {
53+
const isClientImage404 = status === 404 && request.url.includes('/clients/') && request.url.includes('/images');
54+
55+
if (!environment.production && !isClientImage404) {
5456
log.error(`Request Error: ${errorMessage}`);
5557
}
5658

@@ -70,10 +72,10 @@ export class ErrorHandlerInterceptor implements HttpInterceptor {
7072
});
7173
} else if (status === 404) {
7274
// Check if this is an image request that should be silently handled (client profile image)
73-
if (request.url.includes('/clients/') && request.url.includes('/images')) {
75+
if (isClientImage404) {
7476
// Don't show alerts for missing client images
7577
// This is an expected condition, not an error
76-
return new Observable<HttpEvent<any>>();
78+
return EMPTY;
7779
} else {
7880
this.alertService.alert({
7981
type: this.translate.instant('error.resource.not.found'),

0 commit comments

Comments
 (0)