-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Test custom error boundary * Test * Test * Add error boundary to catch full page crashes * Update apps/studio/components/ui/ErrorBoundaryState.tsx Co-authored-by: Alaister Young <[email protected]> --------- Co-authored-by: Alaister Young <[email protected]>
- Loading branch information
Showing
7 changed files
with
115 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { ExternalLink } from 'lucide-react' | ||
import Link from 'next/link' | ||
import { useRouter } from 'next/router' | ||
import type { FallbackProps } from 'react-error-boundary' | ||
|
||
import { Button } from 'ui' | ||
|
||
export const ErrorBoundaryState = ({ error, resetErrorBoundary }: FallbackProps) => { | ||
const router = useRouter() | ||
const message = `Path name: ${router.pathname}\n\n${error.stack}` | ||
|
||
return ( | ||
<div className="w-screen h-screen flex items-center justify-center flex-col gap-y-3"> | ||
<div className="flex items-center flex-col gap-y-1"> | ||
<p className="text-sm"> | ||
Application error: a client-side exception has occurred (see browser console for more | ||
information) | ||
</p> | ||
<p className="text-sm text-foreground-light">Error: {error.message}</p> | ||
</div> | ||
|
||
<div className="flex items-center justify-center gap-x-2"> | ||
<Button asChild type="default" icon={<ExternalLink />}> | ||
<Link | ||
href={`/support/new?category=dashboard_bug&subject=Client%20side%20exception%20occured%20on%20dashboard&message=${encodeURI(message)}`} | ||
target="_blank" | ||
> | ||
Report to support | ||
</Link> | ||
</Button> | ||
{/* [Joshen] For local and staging, allow us to escape the error boundary */} | ||
{/* We could actually investigate how to make this available on prod, but without being able to reliably test this, I'm not keen to do it now */} | ||
{process.env.NEXT_PUBLIC_ENVIRONMENT !== 'prod' && ( | ||
<Button type="outline" onClick={() => resetErrorBoundary()}> | ||
Return to dashboard | ||
</Button> | ||
)} | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.