HKBase

Error Pages Demo

...

⚠️ These buttons will intentionally trigger errors for demonstration purposes.

⚠️ 重要:如何正確測試自定義錯誤頁面

  • 🚨 Development 環境 (npm run dev) 不會顯示自定義錯誤頁面!
  • 必須使用 Production 模式測試:
  • 1. 執行 npm run build
  • 2. 執行 npm start
  • 3. 然後訪問 http://localhost:3000
  • • 在 dev 模式下,Next.js 會顯示開發者錯誤面板,阻擋自定義錯誤頁面

錯誤類型說明

404 Not Found
當訪問不存在的頁面路由時,會顯示 not-found.tsx 自定義 404 頁面
500 Server Error
當頁面拋出錯誤時,會顯示 error.tsx 自定義錯誤邊界頁面
Auth Error
Better-Auth 認證失敗時,會顯示 error page 並帶有錯誤參數
Global Error (未實作按鈕)
當 root layout 拋出錯誤時,會顯示 global-error.tsx (需要在 layout.tsx 中拋出錯誤才能觸發)
HKBase - Hong Kong Base