Skip to content

Commit

Permalink
add default error message
Browse files Browse the repository at this point in the history
  • Loading branch information
jackiequach committed Oct 11, 2024
1 parent b65471b commit 2f8d9c7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/pages/_error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ const Error = ({ statusCode }) => {
}
}, [isError, setIsError, setStatusCode, statusCode]);

// default to 400 messages for unexpected error codes
const errorValues = errorMap[statusCode]
? errorMap[statusCode]
: errorMap[400];

return (
<Layout>
<Flex
Expand All @@ -62,14 +67,14 @@ const Error = ({ statusCode }) => {
width={100}
/>
<Heading marginTop="s" marginBottom="s">
{errorMap[statusCode].heading}
{errorValues.heading}
</Heading>
<Box>
<Text noSpace display={{ base: "inline", md: "block" }}>
{errorMap[statusCode].subText}
{errorValues.subText}
</Text>
<Text noSpace display="inline">
{errorMap[statusCode].tryText}
{errorValues.tryText}
</Text>
<Button
buttonType="text"
Expand Down

0 comments on commit 2f8d9c7

Please sign in to comment.