refactor(errors): normalize user-facing error messages
This commit is contained in:
@@ -11,12 +11,19 @@
|
||||
* 因为它会替换根 layout。
|
||||
*/
|
||||
|
||||
import { ExceptionHandler } from "@/core/errors";
|
||||
|
||||
interface GlobalErrorProps {
|
||||
error: Error & { digest?: string };
|
||||
unstable_retry?: () => void;
|
||||
}
|
||||
|
||||
export default function GlobalError({ error }: GlobalErrorProps) {
|
||||
const errorMessage = ExceptionHandler.message(
|
||||
error,
|
||||
"An unexpected error occurred.",
|
||||
);
|
||||
|
||||
return (
|
||||
<html lang="en">
|
||||
<body
|
||||
@@ -32,7 +39,7 @@ export default function GlobalError({ error }: GlobalErrorProps) {
|
||||
Something went wrong
|
||||
</h1>
|
||||
<p style={{ marginBottom: "1rem", opacity: 0.8 }}>
|
||||
{error.message || "An unexpected error occurred."}
|
||||
{errorMessage}
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
Reference in New Issue
Block a user