Skip to content

forEach should unsubscribe if callback function throws #1411

Closed
@zenparsing

Description

Test case:

new Rx.Observable(sink => {
    sink.next(1); 
    sink.next(2); 
    sink.complete();
}).forEach(x => {
    console.log(x);
    throw new Error("boom");
}).catch(err => console.log(err));

Expected result: Only "1" is logged.
Actual result: "1" and "2" are logged.

I recently fixed this issue over on es-observable:

Metadata

Assignees

Labels

bugConfirmed bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions