Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

Commit

Permalink
Propagate the error on Mutate
Browse files Browse the repository at this point in the history
closed #121
  • Loading branch information
fabien0102 committed May 16, 2019
1 parent baaa9b6 commit fac917e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Mutate.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@ describe("Mutate", () => {
message: "Failed to fetch: 500 Internal Server Error",
status: 500,
});
expect(children.mock.calls[2][1].error).toEqual({
data: { error: "oh no… not again…" },
message: "Failed to fetch: 500 Internal Server Error",
status: 500,
});
});
});

Expand Down
1 change: 1 addition & 0 deletions src/Mutate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ class ContextlessMutate<TData, TError, TQueryParams, TRequestBody> extends React
};

this.setState({
error,
loading: false,
});

Expand Down

0 comments on commit fac917e

Please sign in to comment.