Skip to content

Commit a137b59

Browse files
markostanimirovicbrandonroberts
authored andcommitted
fix(data): revert throwError usages with factory for RxJS 6 compatibility
Closes #3702
1 parent 726dfb7 commit a137b59

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

modules/data/src/dataservices/default-data.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export class DefaultDataService<T> implements EntityCollectionDataService<T> {
168168
}
169169
default: {
170170
const error = new Error('Unimplemented HTTP method, ' + method);
171-
result$ = throwError(() => error);
171+
result$ = throwError(error);
172172
}
173173
}
174174
if (this.timeout) {
@@ -184,7 +184,7 @@ export class DefaultDataService<T> implements EntityCollectionDataService<T> {
184184
return ok;
185185
}
186186
const error = new DataServiceError(err, reqData);
187-
return throwError(() => error);
187+
return throwError(error);
188188
};
189189
}
190190

modules/data/src/dataservices/entity-cache-data.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class EntityCacheDataService {
7979
protected handleError(reqData: RequestData) {
8080
return (err: any) => {
8181
const error = new DataServiceError(err, reqData);
82-
return throwError(() => error);
82+
return throwError(error);
8383
};
8484
}
8585

modules/data/src/dispatchers/entity-cache-dispatcher.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,13 @@ export class EntityCacheDispatcher {
206206
mergeMap((act) => {
207207
return act.type === EntityCacheAction.SAVE_ENTITIES_CANCEL
208208
? throwError(
209-
() =>
210-
new PersistanceCanceled(
211-
(act as SaveEntitiesCancel).payload.reason
212-
)
209+
new PersistanceCanceled(
210+
(act as SaveEntitiesCancel).payload.reason
211+
)
213212
)
214213
: act.type === EntityCacheAction.SAVE_ENTITIES_SUCCESS
215214
? of((act as SaveEntitiesSuccess).payload.changeSet)
216-
: throwError(() => (act as SaveEntitiesError).payload);
215+
: throwError((act as SaveEntitiesError).payload);
217216
})
218217
);
219218
}

modules/data/src/dispatchers/entity-dispatcher-base.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,10 +590,10 @@ export class EntityDispatcherBase<T> implements EntityDispatcher<T> {
590590
mergeMap((act) => {
591591
const { entityOp } = act.payload;
592592
return entityOp === EntityOp.CANCEL_PERSIST
593-
? throwError(() => new PersistanceCanceled(act.payload.data))
593+
? throwError(new PersistanceCanceled(act.payload.data))
594594
: entityOp.endsWith(OP_SUCCESS)
595595
? of(act.payload.data as D)
596-
: throwError(() => act.payload.data.error);
596+
: throwError(act.payload.data.error);
597597
})
598598
);
599599
}

0 commit comments

Comments
 (0)