Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 30ced2f

Browse files
committed
Clean up ErrorSummary while I'm here
1 parent b5fd9c8 commit 30ced2f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import React from "react"
22

3+
const Language = {
4+
unknownErrorMessage: "Unknown error"
5+
}
6+
37
export interface ErrorSummaryProps {
48
error: Error | unknown
59
}
@@ -8,8 +12,8 @@ export const ErrorSummary: React.FC<ErrorSummaryProps> = ({ error }) => {
812
// TODO: More interesting error page
913

1014
if (!(error instanceof Error)) {
11-
return <div>{"Unknown error"}</div>
15+
return <div>{Language.unknownErrorMessage}</div>
16+
} else {
17+
return <div>{error.toString()}</div>
1218
}
13-
14-
return <div>{error.toString()}</div>
1519
}

0 commit comments

Comments
 (0)