Last active
April 26, 2017 04:54
-
-
Save Ibro/613c3340cfe0cd6ad953e6f921a02fe8 to your computer and use it in GitHub Desktop.
Creating Observable error with throw - error method on observer - Coding Blast - www.codingblast.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let source = Observable.create(observer => { | |
for (let word of words) { | |
if (word === 'badword') { | |
throw new Error('Bad word!'); | |
} | |
observer.next(word); | |
} | |
observer.complete(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment