From 788f8e99902ac9d19f65b63e590dfd6bfe269ffa Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Wed, 21 Feb 2024 19:13:49 -0500 Subject: [PATCH] Add unspecified error for when shit hits the fan --- pages/[username].tsx | 4 ++-- pages/saved.tsx | 4 ++-- pages/teams.tsx | 4 ++-- public/locales/en/common.json | 4 ++++ public/locales/ja/common.json | 4 ++++ 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/pages/[username].tsx b/pages/[username].tsx index 6467610b..a9703ea5 100644 --- a/pages/[username].tsx +++ b/pages/[username].tsx @@ -399,8 +399,8 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex context: null, error: true, status: { - code: response?.status, - text: response?.statusText, + code: response ? response.status : -999, + text: response ? response.statusText : 'unspecified_error', }, ...(await serverSideTranslations(locale, ['common'])), }, diff --git a/pages/saved.tsx b/pages/saved.tsx index 282b3a99..c19af934 100644 --- a/pages/saved.tsx +++ b/pages/saved.tsx @@ -429,8 +429,8 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex context: null, error: true, status: { - code: response?.status, - text: response?.statusText, + code: response ? response.status : -999, + text: response ? response.statusText : 'unspecified_error', }, ...(await serverSideTranslations(locale, ['common'])), }, diff --git a/pages/teams.tsx b/pages/teams.tsx index e6d79979..dac95c85 100644 --- a/pages/teams.tsx +++ b/pages/teams.tsx @@ -438,8 +438,8 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex context: null, error: true, status: { - code: response?.status, - text: response?.statusText, + code: response ? response.status : -999, + text: response ? response.statusText : "unspecified_error", }, ...(await serverSideTranslations(locale, ['common'])), }, diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 731a46d5..0a044dae 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -123,6 +123,10 @@ "unauthorized": { "title": "Unauthorized", "description": "You don't have permission to perform that action" + }, + "unspecified_error": { + "title": "Something went wrong", + "description": "You shouldn't see this message. Please try again later." } }, "filters": { diff --git a/public/locales/ja/common.json b/public/locales/ja/common.json index e3899838..fe8f8521 100644 --- a/public/locales/ja/common.json +++ b/public/locales/ja/common.json @@ -123,6 +123,10 @@ "unauthorized": { "title": "権限がありません", "description": "行ったアクションを実行する権限がありません" + }, + "unspecified_error": { + "title": "エラー", + "description": "エラーが発生しました" } }, "filters": {