<commit_before># retry
####signature: `retry(number: number): Observable`

### Description

###### TL;DR: Retry provided number of times on error

The **retry** operator mirrors the output of the source except in the case of an error.  When an error occurs [if the retry count has not been reached the source is resubscribed](https://github.com/ReactiveX/rxjs/blob/da8c1c24e988b9b557126be6dfbc714379322f73/src/operator/retry.ts#L57-L63). If the supplied retry count is reached and there is still an error, the [error will be emitted](https://github.com/ReactiveX/rxjs/blob/da8c1c24e988b9b557126be6dfbc714379322f73/src/operator/retry.ts#L56).

### Examples

##### Example 1: Retry 2 times on error

( [jsBin](http://jsbin.com/yovacuxuqa/1/edit?js,console) | [jsFiddle](https://jsfiddle.net/btroncone/hg7z16bo/) )

```js
//emit value every 1s
const source = Rx.Observable.interval(1000);
const example = source
  .flatMap(val => {
    //throw error for demonstration
    if(val > 5){
      return Rx.Observable.throw('Error!');
    }
    return Rx.Observable.of(val);
  })
  //retry 2 times on error
  .retry(2);
/*
  output: 
  0..1..2..3..4..5..
  0..1..2..3..4..5..
  0..1..2..3..4..5..
  "Error!: Retried 2 times then quit!"
*/
const subscribe = example
  .subscribe({
     next: val => console.log(val),<commit_msg>simplify retry description<commit_after># retry
####signature: `retry(number: number): Observable`

### Description

## Retry the previous observable sequence specified number of times.

### Examples

##### Example 1: Retry 2 times on error

( [jsBin](http://jsbin.com/yovacuxuqa/1/edit?js,console) | [jsFiddle](https://jsfiddle.net/btroncone/hg7z16bo/) )

```js
//emit value every 1s
const source = Rx.Observable.interval(1000);
const example = source
  .flatMap(val => {
    //throw error for demonstration
    if(val > 5){
      return Rx.Observable.throw('Error!');
    }
    return Rx.Observable.of(val);
  })
  //retry 2 times on error
  .retry(2);
/*
  output: 
  0..1..2..3..4..5..
  0..1..2..3..4..5..
  0..1..2..3..4..5..
  "Error!: Retried 2 times then quit!"
*/
const subscribe = example
  .subscribe({
     next: val => console.log(val),
{'fraction_non_alphanumeric': 0.1688191881918819, 'fraction_numerical': 0.05719557195571956, 'mean_word_length': 3.3641851106639837, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '799245', 'n_tokens_mistral': 837, 'n_tokens_neox': 763, 'n_words': 192}