From c89a3102106cf4e4f3b1538a608fc4c78dd62d65 Mon Sep 17 00:00:00 2001 From: Anand Chowdhary Date: Tue, 17 Nov 2020 21:19:16 +0530 Subject: [PATCH] :recycle: Add error handler helper --- src/utils/createOctokit.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/utils/createOctokit.js b/src/utils/createOctokit.js index 368b7f9..9cfc1b6 100644 --- a/src/utils/createOctokit.js +++ b/src/utils/createOctokit.js @@ -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); + } };