Skip to content

Commit

Permalink
エラーハンドリングした close #3
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-20 committed Jan 2, 2025
1 parent 8ca88b8 commit 83ccad8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/app/[locale]/(app)/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use client';

import { Button } from '@/shared/components/ui/button';
import { IconExclamationCircle } from '@tabler/icons-react';
import { t } from 'i18next';
import type { FC } from 'react';

type Props = {
error: Error;
reset: () => void;
};

const ErrorPage: FC<Props> = ({ error, reset }) => {
console.error(error);

return (
<div className="h-full flex flex-col items-center justify-center space-y-4">
<IconExclamationCircle className="size-10" />
<p>{t('common:error.message')}</p>
<Button onClick={reset}>{t('common:error.reload')}</Button>
</div>
);
};

export default ErrorPage;
4 changes: 4 additions & 0 deletions src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,9 @@ export const en = {
'Calculate the expected value of the dice, etc. You can predict what kind of result you will get when you roll the dice.',
},
ccfolia: { title: 'CCFOLIA Export' },
error: {
message: 'An unexpected error occurred.',
reload: 'Reload Page',
},
},
};
4 changes: 4 additions & 0 deletions src/locales/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,9 @@ export const ja = {
description: 'ダイスの期待値などを計算します。ダイスを振るときに、どういう結果が出るのかを予測できます。',
},
ccfolia: { title: 'ココフォリア出力' },
error: {
message: '予期せぬエラーが発生しました',
reload: '再読み込み',
},
},
};

0 comments on commit 83ccad8

Please sign in to comment.