mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-14 20:40:21 +02:00
Add error boundary
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { Box, Center, Group, Stack } from '@mantine/core';
|
||||
import { RiErrorWarningLine } from 'react-icons/ri';
|
||||
import styled from 'styled-components';
|
||||
import { Button, Text } from '@/renderer/components';
|
||||
|
||||
const Container = styled(Box)`
|
||||
background: var(--main-bg);
|
||||
`;
|
||||
|
||||
export const ErrorFallback = ({ error, resetErrorBoundary }: any) => {
|
||||
return (
|
||||
<Container>
|
||||
<Center sx={{ height: '100vh' }}>
|
||||
<Stack>
|
||||
<Group spacing="xs">
|
||||
<RiErrorWarningLine color="var(--danger-color)" size={30} />
|
||||
<Text size="lg">Something went wrong</Text>
|
||||
</Group>
|
||||
<Text>{error.message}</Text>
|
||||
<Button variant="filled" onClick={resetErrorBoundary}>
|
||||
Reload
|
||||
</Button>
|
||||
</Stack>
|
||||
</Center>
|
||||
</Container>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user