refactor(errors): normalize user-facing error messages

This commit is contained in:
2026-07-03 13:05:46 +08:00
parent 65d972fbb4
commit 8a71041b5d
7 changed files with 72 additions and 10 deletions
+8 -1
View File
@@ -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"