Skip to content

Instantly share code, notes, and snippets.

@Ibro
Last active April 29, 2017 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ibro/6cb4f20c274091f1ad8a3bca186df1a8 to your computer and use it in GitHub Desktop.
Save Ibro/6cb4f20c274091f1ad8a3bca186df1a8 to your computer and use it in GitHub Desktop.
RxJS - Error Handling - Coding Blast - www.codingblast.com
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';
})
.retryWhen(errors => errors.delay(5000).take(1))
.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