-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(graph): add error boundary error page for project details
- Loading branch information
1 parent
c523d52
commit f31934b
Showing
4 changed files
with
41 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useEnvironmentConfig } from '@nx/graph/shared'; | ||
import { useRouteError } from 'react-router-dom'; | ||
|
||
export function ErrorBoundary() { | ||
let error = useRouteError().toString(); | ||
console.error(error); | ||
const environment = useEnvironmentConfig()?.environment; | ||
|
||
let message = 'Failed to fetch data for graph. '; | ||
if (environment === 'nx-console') { | ||
message += 'Please refresh the page.'; | ||
} else { | ||
message += 'Please rerun the command and refresh the page.'; | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col bg-gray-50 items-center justify-center h-screen w-full"> | ||
<h1 className="text-4xl mb-4">Error</h1> | ||
<div> | ||
<p className="text-lg mb-4">{message}</p> | ||
<p className="text-sm text-gray-500">Error message: {error}</p> | ||
</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