Skip to content

Commit d525901

Browse files
error handling in NATS interceptor (#1106)
Signed-off-by: pranalidhanavade <[email protected]>
1 parent 0c9bc16 commit d525901

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

libs/interceptors/nats.interceptor.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,11 @@ import {
1717
intercept(context: ExecutionContext, next: CallHandler): Observable<unknown> {
1818
return next.handle().pipe(
1919
catchError((error) => {
20-
21-
if ('string' === typeof error.message && error.message.includes(ResponseMessages.nats.error.natsConnect)) {
20+
if (error.message.includes(ResponseMessages.nats.error.natsConnect)) {
2221
this.logger.error(`No subscribers for message: ${error.message}`);
2322
return throwError(() => new HttpException(ResponseMessages.nats.error.noSubscribers, 500));
24-
} else if (error.message.message) {
25-
return throwError(() => new HttpException(error.message.message, error.statusCode));
2623
}
27-
return throwError(() => error);
24+
return throwError(() => error);
2825
})
2926
);
3027
}

0 commit comments

Comments
 (0)