Skip to content

Commit de7becf

Browse files
demenskybenlesh
authored andcommitted
feat(operator): removed deprecated onErrorResumeNext operator
BREAKING CHANGE: The `onErrorResumeNext` operator is no longer available. Use `onErrorResumeNextWith`.
1 parent 3c0553b commit de7becf

File tree

6 files changed

+36
-41
lines changed

6 files changed

+36
-41
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
11
import { of } from 'rxjs';
2-
import { onErrorResumeNext } from 'rxjs/operators';
2+
import { onErrorResumeNextWith } from 'rxjs/operators';
33

44
it('should infer correctly', () => {
5-
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext()); // $ExpectType Observable<string>
5+
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNextWith()); // $ExpectType Observable<string>
66
});
77

88
it('should accept one input', () => {
9-
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(of(1))); // $ExpectType Observable<string | number>
10-
const p = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(of('5'))); // $ExpectType Observable<string>
9+
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNextWith(of(1))); // $ExpectType Observable<string | number>
10+
const p = of('apple', 'banana', 'peach').pipe(onErrorResumeNextWith(of('5'))); // $ExpectType Observable<string>
1111
});
1212

1313
it('should accept promises', () => {
14-
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(Promise.resolve(5))); // $ExpectType Observable<string | number>
14+
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNextWith(Promise.resolve(5))); // $ExpectType Observable<string | number>
1515
});
1616

1717
it('should accept iterables', () => {
18-
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext('foo')); // $ExpectType Observable<string>
18+
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNextWith('foo')); // $ExpectType Observable<string>
1919
});
2020

2121
it('should accept arrays', () => {
22-
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext([5])); // $ExpectType Observable<string | number>
22+
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNextWith([5])); // $ExpectType Observable<string | number>
2323
});
2424

2525
it('should accept two inputs', () => {
26-
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(of(1), of(2))); // $ExpectType Observable<string | number>
26+
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNextWith(of(1), of(2))); // $ExpectType Observable<string | number>
2727
});
2828

2929
it('should accept three inputs', () => {
30-
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(of(1), of(2), of('3'))); // $ExpectType Observable<string | number>
30+
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNextWith(of(1), of(2), of('3'))); // $ExpectType Observable<string | number>
3131
});
3232

3333
it('should accept four inputs', () => {
34-
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(of(1), of(2), of('3'), of('4'))); // $ExpectType Observable<string | number>
34+
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNextWith(of(1), of(2), of('3'), of('4'))); // $ExpectType Observable<string | number>
3535
});
3636

3737
it('should accept five inputs', () => {
38-
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(of(1), of(2), of('3'), of('4'), of(5))); // $ExpectType Observable<string | number>
38+
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNextWith(of(1), of(2), of('3'), of('4'), of(5))); // $ExpectType Observable<string | number>
3939
});
4040

4141
it('should accept six inputs', () => {
42-
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(of(1), of(2), of('3'), of('4'), of(5), of('6'))); // $ExpectType Observable<string | number>
42+
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNextWith(of(1), of(2), of('3'), of('4'), of(5), of('6'))); // $ExpectType Observable<string | number>
4343
});
4444

4545
it('should accept seven and more inputs', () => {
46-
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(of(1), of(2), of('3'), of('4'), of(5), of('6'), of(7))); // $ExpectType Observable<string | number>
46+
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNextWith(of(1), of(2), of('3'), of('4'), of(5), of('6'), of(7))); // $ExpectType Observable<string | number>
4747
});
4848

4949
it('should enforce types', () => {
50-
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(5)); // $ExpectError
51-
});
50+
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNextWith(5)); // $ExpectError
51+
});

spec/operators/onErrorResumeNext-spec.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { expect } from 'chai';
22
import { TestScheduler } from 'rxjs/testing';
3-
import { onErrorResumeNext, take, finalize, tap } from 'rxjs/operators';
3+
import { onErrorResumeNextWith, take, finalize, tap } from 'rxjs/operators';
44
import { concat, throwError, of, Observable } from 'rxjs';
55
import { asInteropObservable } from '../helpers/interop-helper';
66
import { observableMatcher } from '../helpers/observableMatcher';
77

8-
describe('onErrorResumeNext', () => {
8+
describe('onErrorResumeNextWith', () => {
99
let testScheduler: TestScheduler;
1010

1111
beforeEach(() => {
@@ -20,7 +20,7 @@ describe('onErrorResumeNext', () => {
2020
const e2subs = ' --------^-------!';
2121
const expected = '--a--b----c--d--|';
2222

23-
expectObservable(e1.pipe(onErrorResumeNext(e2))).toBe(expected);
23+
expectObservable(e1.pipe(onErrorResumeNextWith(e2))).toBe(expected);
2424
expectSubscriptions(e1.subscriptions).toBe(e1subs);
2525
expectSubscriptions(e2.subscriptions).toBe(e2subs);
2626
});
@@ -34,7 +34,7 @@ describe('onErrorResumeNext', () => {
3434
const e2subs = ' --------^-------!';
3535
const expected = '--a--b----c--d--|';
3636

37-
expectObservable(e1.pipe(onErrorResumeNext(e2))).toBe(expected);
37+
expectObservable(e1.pipe(onErrorResumeNextWith(e2))).toBe(expected);
3838
expectSubscriptions(e1.subscriptions).toBe(e1subs);
3939
expectSubscriptions(e2.subscriptions).toBe(e2subs);
4040
});
@@ -56,7 +56,7 @@ describe('onErrorResumeNext', () => {
5656
];
5757
const expected = '--a--b----c--d----e----f--g--|';
5858

59-
expectObservable(e1.pipe(onErrorResumeNext(e2))).toBe(expected);
59+
expectObservable(e1.pipe(onErrorResumeNextWith(e2))).toBe(expected);
6060
expectSubscriptions(e1.subscriptions).toBe(e1subs);
6161
expectSubscriptions(e2[0].subscriptions).toBe(e2subs[0]);
6262
expectSubscriptions(e2[1].subscriptions).toBe(e2subs[1]);
@@ -76,7 +76,7 @@ describe('onErrorResumeNext', () => {
7676
const e4subs = ' ---------------------^-------!';
7777
const expected = '--a--b----c--d----e----f--g--|';
7878

79-
expectObservable(e1.pipe(onErrorResumeNext(e2, e3, e4))).toBe(expected);
79+
expectObservable(e1.pipe(onErrorResumeNextWith(e2, e3, e4))).toBe(expected);
8080
expectSubscriptions(e1.subscriptions).toBe(e1subs);
8181
expectSubscriptions(e2.subscriptions).toBe(e2subs);
8282
expectSubscriptions(e3.subscriptions).toBe(e3subs);
@@ -96,7 +96,7 @@ describe('onErrorResumeNext', () => {
9696
const e4subs = ' ---------------------^-------!';
9797
const expected = '--a--b----c--d----e----f--g--|';
9898

99-
expectObservable(e1.pipe(onErrorResumeNext(e2, e3, e4))).toBe(expected);
99+
expectObservable(e1.pipe(onErrorResumeNextWith(e2, e3, e4))).toBe(expected);
100100
expectSubscriptions(e1.subscriptions).toBe(e1subs);
101101
expectSubscriptions(e2.subscriptions).toBe(e2subs);
102102
expectSubscriptions(e3.subscriptions).toBe(e3subs);
@@ -116,7 +116,7 @@ describe('onErrorResumeNext', () => {
116116
const e4subs = ' -------------^-------!';
117117
const expected = '--c--d----e----f--g--|';
118118

119-
expectObservable(e1.pipe(onErrorResumeNext(e2, e3, e4))).toBe(expected);
119+
expectObservable(e1.pipe(onErrorResumeNextWith(e2, e3, e4))).toBe(expected);
120120
expectSubscriptions(e1.subscriptions).toBe(e1subs);
121121
expectSubscriptions(e2.subscriptions).toBe(e2subs);
122122
expectSubscriptions(e3.subscriptions).toBe(e3subs);
@@ -132,7 +132,7 @@ describe('onErrorResumeNext', () => {
132132
const e2subs = ' --------^-';
133133
const expected = '--a--b----';
134134

135-
expectObservable(e1.pipe(onErrorResumeNext(e2))).toBe(expected);
135+
expectObservable(e1.pipe(onErrorResumeNextWith(e2))).toBe(expected);
136136
expectSubscriptions(e1.subscriptions).toBe(e1subs);
137137
expectSubscriptions(e2.subscriptions).toBe(e2subs);
138138
});
@@ -146,7 +146,7 @@ describe('onErrorResumeNext', () => {
146146
const e2subs: string[] = [];
147147
const expected = '--a--';
148148

149-
expectObservable(e1.pipe(onErrorResumeNext(e2))).toBe(expected);
149+
expectObservable(e1.pipe(onErrorResumeNextWith(e2))).toBe(expected);
150150
expectSubscriptions(e1.subscriptions).toBe(e1subs);
151151
expectSubscriptions(e2.subscriptions).toBe(e2subs);
152152
});
@@ -160,7 +160,7 @@ describe('onErrorResumeNext', () => {
160160
const e2subs = ' --------^-------!';
161161
const expected = '--a--b----c--d--|';
162162

163-
expectObservable(e1.pipe(onErrorResumeNext(e2))).toBe(expected);
163+
expectObservable(e1.pipe(onErrorResumeNextWith(e2))).toBe(expected);
164164
expectSubscriptions(e1.subscriptions).toBe(e1subs);
165165
expectSubscriptions(e2.subscriptions).toBe(e2subs);
166166
});
@@ -178,7 +178,7 @@ describe('onErrorResumeNext', () => {
178178
});
179179

180180
throwError(() => new Error('Some error'))
181-
.pipe(onErrorResumeNext(synchronousObservable), take(3))
181+
.pipe(onErrorResumeNextWith(synchronousObservable), take(3))
182182
.subscribe(() => {
183183
/* noop */
184184
});
@@ -201,7 +201,7 @@ describe('onErrorResumeNext', () => {
201201
// test ensures that unsubscriptions are chained all the way to the
202202
// interop subscriber.
203203

204-
expectObservable(e1.pipe(onErrorResumeNext(asInteropObservable(e2))), unsub).toBe(expected);
204+
expectObservable(e1.pipe(onErrorResumeNextWith(asInteropObservable(e2))), unsub).toBe(expected);
205205
expectSubscriptions(e1.subscriptions).toBe(e1subs);
206206
expectSubscriptions(e2.subscriptions).toBe(e2subs);
207207
});
@@ -214,7 +214,7 @@ describe('onErrorResumeNext', () => {
214214
throwError(() => 'meh')
215215
);
216216

217-
source.pipe(onErrorResumeNext(Promise.resolve(2))).subscribe({
217+
source.pipe(onErrorResumeNextWith(Promise.resolve(2))).subscribe({
218218
next: (x) => {
219219
expect(expected.shift()).to.equal(x);
220220
},
@@ -232,7 +232,7 @@ describe('onErrorResumeNext', () => {
232232
const results: any[] = [];
233233

234234
of(1)
235-
.pipe(onErrorResumeNext([2, 3, 4], { notValid: 'LOL' } as any, of(5, 6)))
235+
.pipe(onErrorResumeNextWith([2, 3, 4], { notValid: 'LOL' } as any, of(5, 6)))
236236
.subscribe({
237237
next: (value) => results.push(value),
238238
complete: () => results.push('complete'),
@@ -247,7 +247,7 @@ describe('onErrorResumeNext', () => {
247247
of(1)
248248
.pipe(
249249
finalize(() => results.push('finalize 1')),
250-
onErrorResumeNext(
250+
onErrorResumeNextWith(
251251
of(2).pipe(finalize(() => results.push('finalize 2'))),
252252
of(3).pipe(finalize(() => results.push('finalize 3'))),
253253
of(4).pipe(finalize(() => results.push('finalize 4')))
@@ -270,7 +270,7 @@ describe('onErrorResumeNext', () => {
270270
subscribe: () => results.push('subscribe 1'),
271271
finalize: () => results.push('finalize 1'),
272272
}),
273-
onErrorResumeNext(
273+
onErrorResumeNextWith(
274274
of(2).pipe(
275275
tap({
276276
subscribe: () => results.push('subscribe 2'),

spec/operators/share-spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
map,
55
mergeMap,
66
mergeMapTo,
7-
onErrorResumeNext,
7+
onErrorResumeNextWith,
88
repeat,
99
retry,
1010
share,
@@ -906,7 +906,7 @@ describe('share', () => {
906906

907907
const sharedSource = source.pipe(share({ resetOnError: () => reset, resetOnRefCountZero }));
908908

909-
const result = concat(sharedSource.pipe(onErrorResumeNext(firstPause)), sharedSource);
909+
const result = concat(sharedSource.pipe(onErrorResumeNextWith(firstPause)), sharedSource);
910910

911911
expectObservable(result, subscription).toBe(expected);
912912
expectSubscriptions(source.subscriptions).toBe(sourceSubs);

src/internal/operators/catchError.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export function catchError<T, O extends ObservableInput<any>>(
9292
* // 1, 2, 3, error in source. Details: four!
9393
* ```
9494
*
95-
* @see {@link onErrorResumeNext}
95+
* @see {@link onErrorResumeNextWith}
9696
* @see {@link repeat}
9797
* @see {@link repeatWhen}
9898
* @see {@link retry }

src/internal/operators/onErrorResumeNextWith.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,3 @@ export function onErrorResumeNextWith<T, A extends readonly unknown[]>(
9292

9393
return (source) => oERNCreate(source, ...nextSources);
9494
}
95-
96-
/**
97-
* @deprecated Renamed. Use {@link onErrorResumeNextWith} instead. Will be removed in v8.
98-
*/
99-
export const onErrorResumeNext = onErrorResumeNextWith;

src/operators/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export { mergeWith } from '../internal/operators/mergeWith';
5252
export { min } from '../internal/operators/min';
5353
export { multicast } from '../internal/operators/multicast';
5454
export { observeOn } from '../internal/operators/observeOn';
55-
export { onErrorResumeNext } from '../internal/operators/onErrorResumeNextWith';
55+
export { onErrorResumeNextWith } from '../internal/operators/onErrorResumeNextWith';
5656
export { pairwise } from '../internal/operators/pairwise';
5757
export { partition } from '../internal/operators/partition';
5858
export { pluck } from '../internal/operators/pluck';

0 commit comments

Comments
 (0)