Last active
April 29, 2017 04:49
-
-
Save Ibro/751da28a1a8d54916daef9e22738c8f8 to your computer and use it in GitHub Desktop.
RxJS - Error Handling - 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
import {Observable} from 'rxjs'; | |
Observable | |
.of('CodingBlast', 'cuteword', 'badword', 'coding', 'blast') | |
.map(w => { | |
if (w === 'badword') { | |
throw new Error('Bad things happen!') | |
} | |
return w + ' RxJS'; | |
}) | |
.catch(err => Observable.throw('throwing from catch!')) | |
.subscribe(value => console.log(value), | |
err => console.error('oops, an error!', err), | |
() => console.log('complete!')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment