Skip to content

Commit 880a715

Browse files
fix: exception handling for common handler (#1108)
* fix: exception handling Signed-off-by: pranalidhanavade <[email protected]> * refactor: NATS interceptor Signed-off-by: pranalidhanavade <[email protected]> * refactor: exception handler component changes Signed-off-by: pranalidhanavade <[email protected]> --------- Signed-off-by: pranalidhanavade <[email protected]>
1 parent d525901 commit 880a715

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

apps/api-gateway/common/exception-handler.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ export class CustomExceptionFilter extends BaseExceptionFilter {
1212

1313
let errorResponse;
1414
let status = HttpStatus.INTERNAL_SERVER_ERROR;
15-
16-
this.logger.error(`exception ::: ${JSON.stringify(exception)}`);
1715

1816
if (!exception || '{}' === JSON.stringify(exception)) {
1917
errorResponse = {

libs/interceptors/nats.interceptor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
intercept(context: ExecutionContext, next: CallHandler): Observable<unknown> {
1818
return next.handle().pipe(
1919
catchError((error) => {
20-
if (error.message.includes(ResponseMessages.nats.error.natsConnect)) {
20+
if (error?.message && error?.message.includes(ResponseMessages.nats.error.natsConnect)) {
2121
this.logger.error(`No subscribers for message: ${error.message}`);
2222
return throwError(() => new HttpException(ResponseMessages.nats.error.noSubscribers, 500));
2323
}

0 commit comments

Comments
 (0)