Skip to content

Commit

Permalink
refactor(retry): Spell success properly (#1254)
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Mar 2, 2021
1 parent 677e902 commit 173f5f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/transporter/src/concerns/retryDecision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ export const retryDecision = <TResponse>(
}

if (isSuccess(response)) {
return outcomes.onSucess(response);
return outcomes.onSuccess(response);
}

return outcomes.onFail(response);
};

export type Outcomes<TResponse> = {
readonly onFail: (response: Response) => Readonly<Promise<never>>;
readonly onSucess: (response: Response) => Readonly<Promise<TResponse>>;
readonly onSuccess: (response: Response) => Readonly<Promise<TResponse>>;
readonly onRetry: (response: Response) => Readonly<Promise<TResponse>>;
};
6 changes: 5 additions & 1 deletion packages/transporter/src/concerns/retryableRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ export function retryableRequest<TResponse>(
};

const decisions: Outcomes<TResponse> = {
onSucess: response => deserializeSuccess(response),
/**
* @deprecated this property is deprecated in favor of `onSuccess`
*/
onSucess: response => onSuccess(response),
onSuccess: response => deserializeSuccess(response),
onRetry(response) {
const stackFrame = pushToStackTrace(response);

Expand Down

0 comments on commit 173f5f1

Please sign in to comment.