优化错误收集

This commit is contained in:
xh
2025-06-26 00:23:35 +08:00
parent edcb95787e
commit 2d473ac4ed
17 changed files with 130 additions and 143 deletions

File diff suppressed because one or more lines are too long

View File

@@ -18,8 +18,7 @@ export type type_monitor_client = {
City?: string City?: string
Operator?: string Operator?: string
Ip?: string Ip?: string
Width?: number
Height?: number
Ua?: string Ua?: string
CreateTime?: string CreateTime?: string
} }
@@ -35,8 +34,7 @@ export type type_monitor_client_query = {
City?: string City?: string
Operator?: string Operator?: string
Ip?: string Ip?: string
Width?: number
Height?: number
Ua?: string Ua?: string
CreateTimeStart?: string CreateTimeStart?: string
CreateTimeEnd?: string CreateTimeEnd?: string
@@ -54,8 +52,7 @@ export type type_monitor_client_edit = {
City?: string City?: string
Operator?: string Operator?: string
Ip?: string Ip?: string
Width?: number
Height?: number
Ua?: string Ua?: string
} }

View File

@@ -23,7 +23,7 @@ interface Props {
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
modelValue: () => ({}), modelValue: () => ({}),
pageSizes: () => [15, 20, 30, 40], pageSizes: () => [10, 15, 20, 30, 40],
layout: 'total, sizes, prev, pager, next, jumper' layout: 'total, sizes, prev, pager, next, jumper'
}) })

View File

@@ -21,7 +21,7 @@ interface Options {
* *
*/ */
export function usePaging<T>(options: Options) { export function usePaging<T>(options: Options) {
const { page = 1, size = 15, fetchFun, params = {}, firstLoading = false } = options const { page = 1, size = 10, fetchFun, params = {}, firstLoading = false } = options
// 记录分页初始参数 // 记录分页初始参数
const paramsInit: Record<any, any> = Object.assign({}, toRaw(params)) const paramsInit: Record<any, any> = Object.assign({}, toRaw(params))
// 分页数据 // 分页数据

View File

@@ -172,10 +172,6 @@
<el-table-column label="城市" prop="City" /> --> <el-table-column label="城市" prop="City" /> -->
<el-table-column label="运营商" prop="Operator" /> <el-table-column label="运营商" prop="Operator" />
<el-table-column label="屏幕" prop="Width">
<template #default="{ row }"> {{ row.Width }} * {{ row.Height }} </template>
</el-table-column>
<!-- <el-table-column label="屏幕高度" prop="Height" min-width="130" /> -->
<!-- <el-table-column label="ua记录" prop="Ua" min-width="380" /> --> <!-- <el-table-column label="ua记录" prop="Ua" min-width="380" /> -->
<el-table-column label="创建时间" prop="CreateTime" min-width="140" /> <el-table-column label="创建时间" prop="CreateTime" min-width="140" />
@@ -238,8 +234,7 @@ const queryParams = reactive<type_monitor_client_query>({
City: null, City: null,
Operator: null, Operator: null,
Ip: null, Ip: null,
Width: null,
Height: null,
Ua: null, Ua: null,
CreateTimeStart: null, CreateTimeStart: null,
CreateTimeEnd: null CreateTimeEnd: null

View File

@@ -154,17 +154,16 @@ func (hd *MonitorClientHandler) Add(c *gin.Context) {
ip := c.ClientIP() ip := c.ClientIP()
if err == nil { if err == nil {
last := lastClient.UserId + lastClient.Width.String() + lastClient.Height.String() + lastClient.Ip + lastClient.Ua last := lastClient.UserId + "_" + lastClient.Ip + "_" + lastClient.Ua
newStr := *addReq.UserId + addReq.Width.String() + addReq.Height.String() + ip + uaStr newStr := *addReq.UserId + "_" + ip + "_" + uaStr
if last == newStr { if last == newStr {
// 前后数据一样,不用创建新的数据 // 前后数据一样,不用创建新的数据
fmt.Println("前后数据一样,不用创建新的数据") fmt.Println("前后用户端数据一样,不用创建新的数据")
c.Data(200, "image/gif", img_util.EmptyGif()) c.Data(200, "image/gif", img_util.EmptyGif())
return return
} else { } else {
// 新建的话需要清除lastClient对应的缓存 // 新建的话需要清除lastClient对应的缓存
monitorService.MonitorClientService.CacheUtil.RemoveCache("ClientId:" + lastClient.ClientId) monitorService.MonitorClientService.CacheUtil.RemoveCache("ClientId:" + lastClient.ClientId)
} }
} }

View File

@@ -6,19 +6,18 @@ import (
// MonitorClient 监控-客户端信息实体 // MonitorClient 监控-客户端信息实体
type MonitorClient struct { type MonitorClient struct {
Id int `gorm:"primarykey;comment:'uuid'"` // uuid Id int `gorm:"primarykey;comment:'uuid'"` // uuid
ProjectKey string `gorm:"comment:'项目key'"` // 项目key ProjectKey string `gorm:"comment:'项目key'"` // 项目key
ClientId string `gorm:"comment:'sdk生成的客户端id'"` // sdk生成的客户端id ClientId string `gorm:"comment:'sdk生成的客户端id'"` // sdk生成的客户端id
UserId string `gorm:"comment:'用户id'"` // 用户id UserId string `gorm:"comment:'用户id'"` // 用户id
Os string `gorm:"comment:'系统'"` // 系统 Os string `gorm:"comment:'系统'"` // 系统
Browser string `gorm:"comment:'浏览器'"` // 浏览器 Browser string `gorm:"comment:'浏览器'"` // 浏览器
Country string `gorm:"comment:'国家'"` // 国家 Country string `gorm:"comment:'国家'"` // 国家
Province string `gorm:"comment:'省份'"` // 省份 Province string `gorm:"comment:'省份'"` // 省份
City string `gorm:"comment:'城市'"` // 城市 City string `gorm:"comment:'城市'"` // 城市
Operator string `gorm:"comment:'电信运营商'"` // 电信运营商 Operator string `gorm:"comment:'电信运营商'"` // 电信运营商
Ip string `gorm:"comment:'ip'"` // ip Ip string `gorm:"comment:'ip'"` // ip
Width core.NullInt `gorm:"comment:'屏幕'"` // 屏幕
Height core.NullInt `gorm:"comment:'屏幕高度'"` // 屏幕高度
Ua string `gorm:"comment:'ua记录'"` // ua记录 Ua string `gorm:"comment:'ua记录'"` // ua记录
CreateTime core.NullTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间 CreateTime core.NullTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
// ClientTime core.NullTime `gorm:"comment:'更新时间'"` // 更新时间 // ClientTime core.NullTime `gorm:"comment:'更新时间'"` // 更新时间

View File

@@ -9,5 +9,7 @@ type MonitorErrorList struct {
Id int `gorm:"primarykey;comment:'id'"` Id int `gorm:"primarykey;comment:'id'"`
Eid string `gorm:"comment:'错误id'"` // 错误表id Eid string `gorm:"comment:'错误id'"` // 错误表id
Cid string `gorm:"comment:'客户端id'"` // 客户端表id Cid string `gorm:"comment:'客户端id'"` // 客户端表id
Width core.NullInt `gorm:"comment:'屏幕'"` // 屏幕
Height core.NullInt `gorm:"comment:'屏幕高度'"` // 屏幕高度
CreateTime core.NullTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间 CreateTime core.NullTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
} }

View File

@@ -45,7 +45,7 @@ INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_sh
// MonitorErrorRoute(rg) // MonitorErrorRoute(rg)
func MonitorErrorRoute(rg *gin.RouterGroup) { func MonitorErrorRoute(rg *gin.RouterGroup) {
handle := monitorController.MonitorErrorHandler{} handle := monitorController.MonitorErrorHandler{}
rg.GET("/monitor_error/add", middleware.RecordLog("监控-错误列新增"), handle.Add) rg.GET("/monitor_error/add", handle.Add)
r := rg.Group("/", middleware.TokenAuth()) r := rg.Group("/", middleware.TokenAuth())
r.GET("/monitor_error/list", handle.List) r.GET("/monitor_error/list", handle.List)

View File

@@ -18,48 +18,41 @@ type MonitorClientListReq struct {
Operator *string // 电信运营商 Operator *string // 电信运营商
Ip *string // ip Ip *string // ip
Width *int // 屏幕
Height *int // 屏幕高度
Ua *string // ua记录 Ua *string // ua记录
CreateTimeStart *string // 开始创建时间 CreateTimeStart *string // 开始创建时间
CreateTimeEnd *string // 结束创建时间 CreateTimeEnd *string // 结束创建时间
} }
// MonitorClientAddReq 监控-客户端信息新增参数 // MonitorClientAddReq 监控-客户端信息新增参数
type MonitorClientAddReq struct { type MonitorClientAddReq struct {
ProjectKey *string // 项目key ProjectKey *string // 项目key
ClientId *string // sdk生成的客户端id ClientId *string // sdk生成的客户端id
UserId *string // 用户id UserId *string // 用户id
Os *string // 系统 Os *string // 系统
Browser *string // 浏览器 Browser *string // 浏览器
Country *string // 国家 Country *string // 国家
Province *string // 省份 Province *string // 省份
City *string // 城市 City *string // 城市
Operator *string // 电信运营商 Operator *string // 电信运营商
Ip *string // ip Ip *string // ip
Width core.NullInt // 屏幕 Ua *string // ua记录
Height core.NullInt // 屏幕高度
Ua *string // ua记录
} }
// MonitorClientEditReq 监控-客户端信息编辑参数 // MonitorClientEditReq 监控-客户端信息编辑参数
type MonitorClientEditReq struct { type MonitorClientEditReq struct {
Id int // uuid Id int // uuid
ProjectKey *string // 项目key ProjectKey *string // 项目key
ClientId *string // sdk生成的客户端id ClientId *string // sdk生成的客户端id
UserId *string // 用户id UserId *string // 用户id
Os *string // 系统 Os *string // 系统
Browser *string // 浏览器 Browser *string // 浏览器
Country *string // 国家 Country *string // 国家
Province *string // 省份 Province *string // 省份
City *string // 城市 City *string // 城市
Operator *string // 电信运营商 Operator *string // 电信运营商
Ip *string // ip Ip *string // ip
Width core.NullInt // 屏幕 Ua *string // ua记录
Height core.NullInt // 屏幕高度
Ua *string // ua记录
} }
// MonitorClientDetailReq 监控-客户端信息详情参数 // MonitorClientDetailReq 监控-客户端信息详情参数
@@ -90,8 +83,9 @@ type MonitorClientResp struct {
City string // 城市 City string // 城市
Operator string // 电信运营商 Operator string // 电信运营商
Ip string // ip Ip string // ip
Width core.NullInt // 屏幕
Height core.NullInt // 屏幕高度
Ua string // ua记录 Ua string // ua记录
CreateTime core.NullTime // 创建时间 CreateTime core.NullTime // 创建时间
Width core.NullInt // 屏幕
Height core.NullInt // 屏幕高度
} }

View File

@@ -6,16 +6,20 @@ import (
// MonitorErrorListAddReq 错误对应的用户记录新增参数 // MonitorErrorListAddReq 错误对应的用户记录新增参数
type MonitorErrorListAddReq struct { type MonitorErrorListAddReq struct {
Eid string // 错误id Eid string // 错误id
Cid string // 客户端id Cid string // 客户端id
Width core.NullInt // 屏幕
Height core.NullInt // 屏幕高度
// ProjectKey string // 项目id // ProjectKey string // 项目id
} }
// MonitorErrorListResp 错误对应的用户记录返回信息 // MonitorErrorListResp 错误对应的用户记录返回信息
type MonitorErrorListResp struct { type MonitorErrorListResp struct {
Id int // 项目id Id int // 项目id
Eid string // 错误id Eid string // 错误id
Cid string // 客户端id Cid string // 客户端id
Width core.NullInt // 屏幕
Height core.NullInt // 屏幕高度
// ProjectKey string // 项目id // ProjectKey string // 项目id
CreateTime core.NullTime // 创建时间 CreateTime core.NullTime // 创建时间
} }

View File

@@ -6,12 +6,13 @@ import (
// MonitorErrorListReq 监控-错误列列表参数 // MonitorErrorListReq 监控-错误列列表参数
type MonitorErrorListReq struct { type MonitorErrorListReq struct {
ProjectKey *string // 项目key ProjectKey *string // 项目key
EventType *string // 事件类型 EventType *string // 事件类型
Path *string // URL地址 Path *string // URL地址
Message *string // 错误消息 Message *string // 错误消息
Stack *string // 错误堆栈 Stack *string // 错误堆栈
Md5 *string // md5 Md5 *string // md5
CreateTimeStart *string // 开始创建时间 CreateTimeStart *string // 开始创建时间
CreateTimeEnd *string // 结束创建时间 CreateTimeEnd *string // 结束创建时间
@@ -19,12 +20,14 @@ type MonitorErrorListReq struct {
// MonitorErrorAddReq 监控-错误列新增参数 // MonitorErrorAddReq 监控-错误列新增参数
type MonitorErrorAddReq struct { type MonitorErrorAddReq struct {
ProjectKey string // 项目key ProjectKey string // 项目key
ClientId string // sdk生成的客户端id ClientId string // sdk生成的客户端id
EventType *string // 事件类型 EventType *string // 事件类型
Path *string // URL地址 Path *string // URL地址
Message *string // 错误消息 Message *string // 错误消息
Stack *string // 错误堆栈 Stack *string // 错误堆栈
Width core.NullInt // 屏幕
Height core.NullInt // 屏幕高度
} }
// MonitorErrorDetailReq 监控-错误列详情参数 // MonitorErrorDetailReq 监控-错误列详情参数
@@ -50,6 +53,8 @@ type MonitorErrorResp struct {
Path string // URL地址 Path string // URL地址
Message string // 错误消息 Message string // 错误消息
Stack string // 错误堆栈 Stack string // 错误堆栈
Width core.NullInt // 屏幕
Height core.NullInt // 屏幕高度
Md5 string // md5 Md5 string // md5
CreateTime core.NullTime // 创建时间 CreateTime core.NullTime // 创建时间
} }

View File

@@ -66,12 +66,7 @@ func (service monitorClientService) GetModel(listReq MonitorClientListReq) *gorm
if listReq.Ip != nil { if listReq.Ip != nil {
dbModel = dbModel.Where("ip = ?", *listReq.Ip) dbModel = dbModel.Where("ip = ?", *listReq.Ip)
} }
if listReq.Width != nil {
dbModel = dbModel.Where("width = ?", *listReq.Width)
}
if listReq.Height != nil {
dbModel = dbModel.Where("height = ?", *listReq.Height)
}
if listReq.Ua != nil { if listReq.Ua != nil {
dbModel = dbModel.Where("ua = ?", *listReq.Ua) dbModel = dbModel.Where("ua = ?", *listReq.Ua)
} }
@@ -170,8 +165,8 @@ func (service monitorClientService) Detail(Id int) (res MonitorClientResp, e err
// ErrorUser 监控-客户端信息详情 // ErrorUser 监控-客户端信息详情
func (service monitorClientService) ErrorUsers(error_id int) (res []MonitorClientResp, e error) { func (service monitorClientService) ErrorUsers(error_id int) (res []MonitorClientResp, e error) {
var obj = []model.MonitorClient{} var obj = []MonitorClientResp{}
service.db.Raw("SELECT client.*,list.create_time AS create_time from x_monitor_error_list as list right join x_monitor_client as client on client.id = list.cid where list.eid = ? Order by list.id DESC LIMIT 0,20", error_id).Scan(&obj) service.db.Raw("SELECT client.*,list.width,list.height,list.create_time AS create_time from x_monitor_error_list as list right join x_monitor_client as client on client.id = list.cid where list.eid = ? Order by list.id DESC LIMIT 0,20", error_id).Scan(&obj)
convert_util.Copy(&res, obj) convert_util.Copy(&res, obj)
return return

View File

@@ -111,16 +111,13 @@ func (service monitorErrorService) ListAll(listReq MonitorErrorListReq) (res []M
// Detail 监控-错误列详情 // Detail 监控-错误列详情
func (service monitorErrorService) Detail(Id int) (res MonitorErrorResp, e error) { func (service monitorErrorService) Detail(Id int) (res MonitorErrorResp, e error) {
var obj = model.MonitorError{} var obj = model.MonitorError{}
err := service.CacheUtil.GetCache(Id, &obj)
if err != nil { err := service.db.Where("id = ?", Id).Limit(1).First(&obj).Error
err := service.db.Where("id = ?", Id).Limit(1).First(&obj).Error if e = response.CheckErrDBNotRecord(err, "数据不存在!"); e != nil {
if e = response.CheckErrDBNotRecord(err, "数据不存在!"); e != nil { return
return }
} if e = response.CheckErr(err, "获取详情失败"); e != nil {
if e = response.CheckErr(err, "获取详情失败"); e != nil { return
return
}
service.CacheUtil.SetCache(obj.Id, obj)
} }
convert_util.Copy(&res, obj) convert_util.Copy(&res, obj)
@@ -165,7 +162,7 @@ func (service monitorErrorService) Add(addReq MonitorErrorAddReq) (createId int,
return 0, err return 0, err
} }
createId = obj.Id createId = obj.Id
service.CacheUtil.SetCache(createId, obj)
service.CacheUtil.SetCache("md5:"+Md5, obj) service.CacheUtil.SetCache("md5:"+Md5, obj)
} else { } else {
createId = errorDetails.Id createId = errorDetails.Id
@@ -176,8 +173,10 @@ func (service monitorErrorService) Add(addReq MonitorErrorAddReq) (createId int,
} }
_, err = MonitorErrorListService.Add(MonitorErrorListAddReq{ _, err = MonitorErrorListService.Add(MonitorErrorListAddReq{
Eid: strconv.Itoa(createId), Eid: strconv.Itoa(createId),
Cid: strconv.Itoa(client.Id), Cid: strconv.Itoa(client.Id),
Width: addReq.Width,
Height: addReq.Height,
// ClientId: addReq.ClientId, // ClientId: addReq.ClientId,
// ProjectKey: addReq.ProjectKey, // ProjectKey: addReq.ProjectKey,
}) })
@@ -199,7 +198,7 @@ func (service monitorErrorService) Del(Id int) (e error) {
// 删除 // 删除
err = service.db.Delete(&obj).Error err = service.db.Delete(&obj).Error
e = response.CheckErr(err, "删除失败") e = response.CheckErr(err, "删除失败")
service.CacheUtil.RemoveCache(obj.Id)
service.CacheUtil.RemoveCache("md5:" + obj.Md5) service.CacheUtil.RemoveCache("md5:" + obj.Md5)
return return
} }
@@ -225,7 +224,7 @@ func (service monitorErrorService) DelBatch(Ids []string) (e error) {
md5s = append(md5s, "md5:"+v.Md5) md5s = append(md5s, "md5:"+v.Md5)
} }
// 删除缓存 // 删除缓存
service.CacheUtil.RemoveCache(Ids)
service.CacheUtil.RemoveCache(md5s) service.CacheUtil.RemoveCache(md5s)
return nil return nil
} }

View File

@@ -1,21 +1,17 @@
export type LogWithEnv = { export type LogWithEnv = {
Type: "env"; Height?: number;
ScreenHeight?: number; Width?: number;
ScreenWidth?: number;
}; };
export type LogWithError = { export type LogWithError =LogWithEnv& {
Type: "error"|"event"|"resources"|'click'; Type: "error" | "event" | "resources" | "click";
EventType: string; EventType: string;
Path:string; Path: string;
Message?: string; Message?: string;
Stack?: string; Stack?: string;
}; };
// 扩展必须实现的接口 // 扩展必须实现的接口
export interface IErrorEvent { export interface IErrorEvent {
upload(url: string, data: object): Promise<void>; upload(url: string, data: object): Promise<void>;
setCache(key: string, info: any): void; setCache(key: string, info: any): void;
getCache(key: string): any; getCache(key: string): any;

View File

@@ -19,6 +19,8 @@ class Base {
private MessageList: any[] = []; private MessageList: any[] = [];
private timer: number = 0; private timer: number = 0;
private lastTimeStamp: number = Date.now(); //上次上报时间戳
private diffTime: number = 1000 * 10; // 上报间隔
constructor(props: Props, platform: IErrorEvent) { constructor(props: Props, platform: IErrorEvent) {
if (!props) { if (!props) {
@@ -50,10 +52,12 @@ class Base {
this.Push(params); this.Push(params);
}); });
// 定时检查发送一次
this.timer = setInterval(() => { this.timer = setInterval(() => {
this.upload(); if (Date.now() - this.lastTimeStamp >= this.diffTime) {
}, 1000 * 10); this.upload();
}
}, 2000);
} }
// 设置用户id // 设置用户id
@@ -67,15 +71,9 @@ class Base {
this.Uid = u_id; this.Uid = u_id;
} }
} }
this.initEnv(); this.uploadInfo();
}
// 初始化环境信息并上传
private initEnv() {
let envInfo = this.platform?.getEnvInfo();
if (envInfo) {
this.uploadInfo(envInfo);
}
} }
// 设置错误ID // 设置错误ID
private setClientID() { private setClientID() {
const client_id = this.platform?.getCache("x_err_client_id"); const client_id = this.platform?.getCache("x_err_client_id");
@@ -109,7 +107,7 @@ class Base {
this.platform?.setCache("x_err_message_list", this.MessageList); this.platform?.setCache("x_err_message_list", this.MessageList);
} }
}; };
public uploadInfo = (envInfo: LogWithEnv) => { public uploadInfo = () => {
if (!this.Dns) return; //未设置Dns服务器不上传 if (!this.Dns) return; //未设置Dns服务器不上传
try { try {
@@ -118,8 +116,8 @@ class Base {
ProjectKey: this.Pid, ProjectKey: this.Pid,
ClientId: this.client_id, ClientId: this.client_id,
UserId: this.Uid, UserId: this.Uid,
Width: envInfo.ScreenWidth, // Width: envInfo.ScreenWidth,
Height: envInfo.ScreenHeight, // Height: envInfo.ScreenHeight,
}) })
.catch((err: any) => { .catch((err: any) => {
// 上传失败 // 上传失败
@@ -133,14 +131,17 @@ class Base {
if (!this.MessageList.length) { if (!this.MessageList.length) {
return; return;
} }
this.lastTimeStamp = Date.now();
try { try {
this.platform this.platform
?.upload(this.Dns + `/admin/monitor_error/add`, this.MessageList) ?.upload(this.Dns + `/admin/monitor_error/add`, this.MessageList)
.catch((err: any) => { .catch((err: any) => {
// 上传失败 // 上传失败
})
.then(() => {
this.MessageList = [];
this.platform?.delCache("x_err_message_list");
}); });
this.MessageList = [];
this.platform?.delCache("x_err_message_list");
} catch (error) {} } catch (error) {}
} }
public unListen() { public unListen() {

View File

@@ -2,11 +2,10 @@ import type {
LogWithError, LogWithError,
LogWithEnv, LogWithEnv,
ListenCallbackFn, ListenCallbackFn,
IErrorEvent IErrorEvent,
} from "../types"; } from "../types";
interface LoggerProps { interface LoggerProps {}
}
class Web implements IErrorEvent { class Web implements IErrorEvent {
props: LoggerProps; props: LoggerProps;
constructor(props?: LoggerProps) { constructor(props?: LoggerProps) {
@@ -54,13 +53,12 @@ class Web implements IErrorEvent {
public getEnvInfo(): LogWithEnv { public getEnvInfo(): LogWithEnv {
const env: LogWithEnv = { const env: LogWithEnv = {
Type: "env", Height: 0,
ScreenHeight: 0, Width: 0,
ScreenWidth: 0,
}; };
if (window) { if (window) {
env.ScreenHeight = window.innerHeight || 0; // 获取显示屏信息 env.Height = window.innerHeight || 0; // 获取显示屏信息
env.ScreenWidth = window.innerWidth || 0; env.Width = window.innerWidth || 0;
} }
return env; return env;
} }
@@ -76,6 +74,7 @@ class Web implements IErrorEvent {
Path: target.src, Path: target.src,
Message: "", Message: "",
Stack: "", Stack: "",
Height: 0,
}); });
} else if (target?.localName === "link") { } else if (target?.localName === "link") {
this.callback({ this.callback({
@@ -91,6 +90,7 @@ class Web implements IErrorEvent {
Path: window.location.href, Path: window.location.href,
Message: err.message, Message: err.message,
Stack: this.handleStack(err.error?.stack || ""), Stack: this.handleStack(err.error?.stack || ""),
...this.getEnvInfo(),
}); });
} }
}; };
@@ -103,6 +103,7 @@ class Web implements IErrorEvent {
Path: window.location.href, Path: window.location.href,
Message: err.reason, Message: err.reason,
Stack: "", Stack: "",
...this.getEnvInfo(),
}); });
} else if (err && typeof err.reason === "object") { } else if (err && typeof err.reason === "object") {
this.callback({ this.callback({
@@ -111,11 +112,11 @@ class Web implements IErrorEvent {
Path: window.location.href, Path: window.location.href,
Message: err.reason?.message || "", Message: err.reason?.message || "",
Stack: this.handleStack(err.reason?.stack || ""), Stack: this.handleStack(err.reason?.stack || ""),
...this.getEnvInfo(),
}); });
} }
}; };
private handleStack(stack: string): string { private handleStack(stack: string): string {
let newStack: string[] = []; let newStack: string[] = [];
if (stack) { if (stack) {