From 5ef2c983b985d53f7d9b06eb62c566d89b8bd5f9 Mon Sep 17 00:00:00 2001 From: Sonu Kapoor Date: Mon, 28 Sep 2020 17:56:57 +0300 Subject: [PATCH] fix(docs-infra): fix the retry-on-error example (#38905) Previously, the `retry` example did not work as intended. The `retry` operator was called before the exception occured, thus not retrying the `ajax` request. This commit moves the `retry` operator into the correct order to ensure that the failed request is retried. PR Close #38905 --- aio/content/examples/rx-library/src/retry-on-error.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aio/content/examples/rx-library/src/retry-on-error.ts b/aio/content/examples/rx-library/src/retry-on-error.ts index b1a5389c1b..6f250aca1a 100644 --- a/aio/content/examples/rx-library/src/retry-on-error.ts +++ b/aio/content/examples/rx-library/src/retry-on-error.ts @@ -8,13 +8,13 @@ import { ajax } from 'rxjs/ajax'; import { map, retry, catchError } from 'rxjs/operators'; const apiData = ajax('/api/data').pipe( - retry(3), // Retry up to 3 times before failing map(res => { if (!res.response) { throw new Error('Value expected!'); } return res.response; }), + retry(3), // Retry up to 3 times before failing catchError(err => of([])) );