Originally, the error is handled as follows.
async getLists() {
try {
const list = await api.getList();
list.filter() ....
} catch(e) {
console.log(e)
}
}
How can I handle it using rxjs in the same situation?
I'm not familiar with rxjs, so I don't know if it's the answer, but the code I thought of is like this.
getLists() {
from(api.getList()).subscribe(
list => list.filter.....,
e => console.log(e)
)
}
I want to know how to handle all the errors that may occur when calling the API, such as try-catch, and the errors that may occur when processing the data received from the API after the API call.
Promises are being returned after API calls, but rxjs must be used If an error occurs, I want to unsubscribe.