createOnError

Creates an object that represents an OnError notification to an observer.

Arguments

  1. exception (Any): The exception contained in the notification.

Returns

(Notification): The OnError notification containing the exception.

var source = Rx.Observable
    .fromArray([
        Rx.Notification.createOnError(new Error('woops'))
    ])
    .dematerialize();

var subscription = source.subscribe(
  x => console.log(`onNext: ${x}`),
  e => console.log(`onError: ${e}`),
  () => console.log('onCompleted'));

// => onError: Error: woops

Example

Last updated