Skip to content

Commit a07edba

Browse files
committed
fix(error): rm unwanted and add version
Signed-off-by: Sudhanshu Dasgupta <[email protected]>
1 parent 98b56ac commit a07edba

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/custom/ErrorBoundary/ErrorBoundary.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,16 @@ interface FallbackComponentProps extends FallbackProps {
3434
children?: React.ReactNode;
3535
pageUrl?: string;
3636
timestamp?: string;
37+
showPackageInfo?: boolean;
38+
version?: string;
3739
}
3840

39-
export function Fallback({ error, children }: FallbackComponentProps): JSX.Element {
40-
const pageUrl = window.location.href;
41-
const timestamp = new Date().toLocaleString();
41+
export function Fallback({
42+
error,
43+
children,
44+
showPackageInfo,
45+
version
46+
}: FallbackComponentProps): JSX.Element {
4247
return (
4348
<div role="alert">
4449
<h2>Uh-oh!😔 Please pardon the mesh.</h2>
@@ -48,9 +53,11 @@ export function Fallback({ error, children }: FallbackComponentProps): JSX.Eleme
4853
{(error as Error).message}
4954
</code>
5055
<br />
51-
<strong> URL: </strong> {pageUrl}
52-
<br />
53-
<strong>Logged at:</strong> {timestamp}
56+
{showPackageInfo && (
57+
<>
58+
<strong>Version:</strong> {version}
59+
</>
60+
)}
5461
</CodeMessage>
5562
<ErrorMessage>
5663
We apologize for the inconvenience. The issue may be on our end. If troubleshooting doesn't

0 commit comments

Comments
 (0)