All files / src/components ErrorView.tsx

100% Statements 3/3
100% Branches 0/0
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20                    2x 2x   2x            
// A page failed to render or load (the root route's errorComponent): log it
// and tell the user: no connection, or something went wrong with the error
// reference.
import Box from '@mui/material/Box'
import { useEffect } from 'react'
import { ReasonAlert } from '#/components/ReasonAlert'
import { clientLog } from '#/lib/client-log'
import { failureReason } from '#/lib/network-error'
 
export function ErrorView({ error }: { error: unknown }) {
  useEffect(() => {
    clientLog.error('app.render_error', {}, error)
  }, [error])
  return (
    <Box component="main" sx={{ px: 2.5, py: 7 }}>
      <ReasonAlert reason={failureReason(error)} />
    </Box>
  )
}