Implementing error handling in the use case method by using subscriptions is my goal. When an error occurs in the adapter, the handling should be done in the use case. However, in the code snippet provided below, the catch block does not seem to work properly as only the error from the adapter is being thrown.
public checkInUsecase(): void {
this.checkInAdapter().subscribe(
(data) => {
this.logger.debug('Work...');
},
(error) => {
this.logger.error('Error.');
},
() => {
this.logger.debug('Successful.');
}
);
}
public checkInAdapter(): Observable<boolean> {
throw new Error('Check in error');
}