handle http errors in rxjs lastValueFrom

Viewed 1244

I have started to use the lastValueFrom() to handle my observable http requests. One of these http calls is returning an error from the server-side, and I am getting the name: 'EmptyError', message: 'no elements in sequence' message

const response = await lastValueFrom(
        this.service.doStuff()
    ).catch((e) => {
        console.log('#1', e);
        return {} as DoStuffResponse;
    });

at #1 the error is EmptyError , not the error from the http call.

I understand why I am getting it (the http observable does not return a value)

However, what I'd like to know is what the actual error is (a 422 unprocessable entity in this case)

Is this possible ?

0 Answers
Related