cujojs / most

Ultra-high performance reactive programming
MIT License
3.49k stars 231 forks source link

Error handling and most.fromObservable #407

Closed Widdershin closed 7 years ago

Widdershin commented 7 years ago

Hi!

While integrating most with @cycle/time, I noticed some curious behavior.

import {Observable} from 'rxjs/Rx';

function boom () {
  throw new Error('boom!');
}

const stream = most.from(Observable.of('a')).map(boom);

stream.subscribe({
  next (ev) {},

  error (err) {
    console.log('Handled error');
  },

  complete () {}
});

I would expect this code to log 'Handled error'. Instead the error is thrown when it occurs, not caught and passed into the error handler in subscribe.

If most.from(Observable.of('a')) is replaced with most.of('a') the code functions as expected.

TylorS commented 7 years ago

Thanks for reporting this error @Widdershin I've opened a possible solution this problem for others to review in #408