Skip to content

Commit

Permalink
♻️ Add error handler helper
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Nov 17, 2020
1 parent 537c4ab commit c89a310
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/utils/createOctokit.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,12 @@ export const createOctokit = () => {
};

export const handleError = (error) => {
console.log("Error handler 123", error);
if (error.message === "Bad credentials") {
window.location.href = "/error";
} else if ((error.message || "").indexOf("rate limit exceeded")) {
window.location.href = "/rate-limit-exceeded";
} else {
window.location.href = "/error";
console.log(error.message);
}
};

0 comments on commit c89a310

Please sign in to comment.