/*
 * @Author: donghao donghao@supervision.ltd
 * @Date: 2025-03-06 14:07:41
 * @LastEditors: donghao donghao@supervision.ltd
 * @LastEditTime: 2025-03-06 14:07:46
 * @FilePath: \vite-ai\data-dashboard\src\utils\error.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
export function registerErrorHandler(app: App) {
    // Vue错误捕获
    app.config.errorHandler = (err, instance, info) => {
      console.error('Vue Error:', err)
      // 发送错误日志...
    }
  
    // 全局未捕获异常
    window.addEventListener('error', event => {
      console.error('Global Error:', event.error)
    })
  
    // 未处理的Promise拒绝
    window.addEventListener('unhandledrejection', event => {
      console.error('Unhandled Rejection:', event.reason)
    })
  }