Question: ```
SELECT DATE(date), SUM(amount) AS `Bank Transfer`
FROM partial_payment
WHERE pay_code = "BT" 
GROUP BY DATE(date)

SELECT DATE(date), SUM(amount) AS Cash
FROM partial_payment
WHERE pay_code = "AC" 
GROUP BY DATE(date)

```

How to combine these 2 SELECT statement so that i can have a table with 3 columns namely DATE(date), Bank Transfer and Cash ?

Answer: 
Error is thrown inside an observable. In your example the function is not returning an observable.

```
public checkInUsecase(): void {
    this.checkInAdapter()
        .pipe(catchError(err) => {
            this.logger.error('Error.');
            throw EMPTY;
        })
        .subscribe((data) => {
            this.logger.debug('Work...');
        });
}

public checkInAdapter(): Observable < boolean > { // this method needs to return an observable
    return new Observable((subscriber) => {
        if (!isAllGood) {
            throw Error('error message'); // error is thrown inside the observable.
        }
    });
}

```
There's a special pipe in Angular that allows you to catch errors in an Observable and react accordingly.

```
public checkInUsecase(): void {
  this.checkInAdapter()
    .pipe(catchError(err) => {
        this.logger.error('Error.');
        throw EMPTY;
    })
    .subscribe((data) => {
        this.logger.debug('Work...');
    });
}

public checkInAdapter(): Observable<boolean> {
  throw new Error('Check in error');
}

```