Skip to content

Commit

Permalink
move error log to avoid failing to log certain errors
Browse files Browse the repository at this point in the history
  • Loading branch information
david-crespo committed Dec 6, 2024
1 parent 927c8b6 commit dc5562f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/components/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export const trigger404 = { type: 'error', statusCode: 404 }
type Props = { error: Error | ApiError }

function ErrorFallback({ error }: Props) {
console.error(error)

if ('statusCode' in error && error.statusCode === 404) {
return <NotFound />
}
Expand All @@ -38,6 +40,5 @@ export const ErrorBoundary = (props: { children: React.ReactNode }) => (
export function RouterDataErrorBoundary() {
// TODO: validate this unknown at runtime _before_ passing to ErrorFallback
const error = useRouteError() as Props['error']
console.error(error)
return <ErrorFallback error={error} />
}

0 comments on commit dc5562f

Please sign in to comment.