Skip to content

Commit

Permalink
fix(data): revert throwError usages with factory for RxJS 6 compatibi…
Browse files Browse the repository at this point in the history
…lity

Closes #3702
  • Loading branch information
markostanimirovic authored and brandonroberts committed Dec 21, 2022
1 parent 726dfb7 commit a137b59
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions modules/data/src/dataservices/default-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export class DefaultDataService<T> implements EntityCollectionDataService<T> {
}
default: {
const error = new Error('Unimplemented HTTP method, ' + method);
result$ = throwError(() => error);
result$ = throwError(error);
}
}
if (this.timeout) {
Expand All @@ -184,7 +184,7 @@ export class DefaultDataService<T> implements EntityCollectionDataService<T> {
return ok;
}
const error = new DataServiceError(err, reqData);
return throwError(() => error);
return throwError(error);
};
}

Expand Down
2 changes: 1 addition & 1 deletion modules/data/src/dataservices/entity-cache-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class EntityCacheDataService {
protected handleError(reqData: RequestData) {
return (err: any) => {
const error = new DataServiceError(err, reqData);
return throwError(() => error);
return throwError(error);
};
}

Expand Down
9 changes: 4 additions & 5 deletions modules/data/src/dispatchers/entity-cache-dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,13 @@ export class EntityCacheDispatcher {
mergeMap((act) => {
return act.type === EntityCacheAction.SAVE_ENTITIES_CANCEL
? throwError(
() =>
new PersistanceCanceled(
(act as SaveEntitiesCancel).payload.reason
)
new PersistanceCanceled(
(act as SaveEntitiesCancel).payload.reason
)
)
: act.type === EntityCacheAction.SAVE_ENTITIES_SUCCESS
? of((act as SaveEntitiesSuccess).payload.changeSet)
: throwError(() => (act as SaveEntitiesError).payload);
: throwError((act as SaveEntitiesError).payload);
})
);
}
Expand Down
4 changes: 2 additions & 2 deletions modules/data/src/dispatchers/entity-dispatcher-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,10 @@ export class EntityDispatcherBase<T> implements EntityDispatcher<T> {
mergeMap((act) => {
const { entityOp } = act.payload;
return entityOp === EntityOp.CANCEL_PERSIST
? throwError(() => new PersistanceCanceled(act.payload.data))
? throwError(new PersistanceCanceled(act.payload.data))
: entityOp.endsWith(OP_SUCCESS)
? of(act.payload.data as D)
: throwError(() => act.payload.data.error);
: throwError(act.payload.data.error);
})
);
}
Expand Down

0 comments on commit a137b59

Please sign in to comment.