Compare commits
2 Commits
ff48593eee
...
0904d47e6f
| Author | SHA1 | Date | |
|---|---|---|---|
| 0904d47e6f | |||
| f4e3051315 |
@@ -40,6 +40,13 @@
|
|||||||
<span>{{ parseTime(scope.row.create_time) }}</span>
|
<span>{{ parseTime(scope.row.create_time) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<!-- 错误信息 -->
|
||||||
|
<el-table-column :label="$t('ErrorLog.table.error_message')" min-width="200" show-overflow-tooltip>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseExceptionMessage(scope.row.exception_detail) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<!-- 错误信息提取 -->
|
||||||
<el-table-column :label="$t('ErrorLog.table.err_del')" width="150px">
|
<el-table-column :label="$t('ErrorLog.table.err_del')" width="150px">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="mini" type="text" @click="info(scope.row.log_id)">{{ $t('ErrorLog.table.see_del') }}</el-button>
|
<el-button size="mini" type="text" @click="info(scope.row.log_id)">{{ $t('ErrorLog.table.see_del') }}</el-button>
|
||||||
@@ -85,6 +92,55 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 解析异常信息
|
||||||
|
parseExceptionMessage(exceptionDetail) {
|
||||||
|
if (!exceptionDetail) {
|
||||||
|
return '-'
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
let exceptionStr = ''
|
||||||
|
|
||||||
|
// 处理不同类型的数据
|
||||||
|
if (typeof exceptionDetail === 'string') {
|
||||||
|
// 尝试 Base64 解码
|
||||||
|
try {
|
||||||
|
exceptionStr = decodeURIComponent(escape(atob(exceptionDetail)))
|
||||||
|
} catch (e) {
|
||||||
|
// 如果不是 Base64,直接使用原字符串
|
||||||
|
exceptionStr = exceptionDetail
|
||||||
|
}
|
||||||
|
} else if (Array.isArray(exceptionDetail)) {
|
||||||
|
// 如果是字节数组,转换为字符串
|
||||||
|
exceptionStr = String.fromCharCode.apply(null, exceptionDetail)
|
||||||
|
} else if (exceptionDetail instanceof Uint8Array) {
|
||||||
|
exceptionStr = new TextDecoder('utf-8').decode(exceptionDetail)
|
||||||
|
} else {
|
||||||
|
return '-'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 匹配 org.nl.common.exception.BadRequestException: 后面的内容
|
||||||
|
const regex = /org\.nl\.common\.exception\.BadRequestException:\s*(.+?)(?:\r?\n|\s+at\s+|$)/
|
||||||
|
const match = exceptionStr.match(regex)
|
||||||
|
|
||||||
|
if (match && match[1]) {
|
||||||
|
return match[1].trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果没有匹配到,尝试匹配其他异常类型
|
||||||
|
const generalRegex = /Exception:\s*(.+?)(?:\r?\n|\s+at\s+|$)/
|
||||||
|
const generalMatch = exceptionStr.match(generalRegex)
|
||||||
|
|
||||||
|
if (generalMatch && generalMatch[1]) {
|
||||||
|
return generalMatch[1].trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
return '-'
|
||||||
|
} catch (error) {
|
||||||
|
console.error('解析异常信息失败:', error)
|
||||||
|
return '-'
|
||||||
|
}
|
||||||
|
},
|
||||||
// 获取异常详情
|
// 获取异常详情
|
||||||
info(log_id) {
|
info(log_id) {
|
||||||
this.dialog = true
|
this.dialog = true
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export default {
|
|||||||
'description': 'description',
|
'description': 'description',
|
||||||
'browser': 'browser',
|
'browser': 'browser',
|
||||||
'create_time': 'create time',
|
'create_time': 'create time',
|
||||||
|
'error_message': 'error message',
|
||||||
'err_del': 'exception details',
|
'err_del': 'exception details',
|
||||||
'see_del': 'view details',
|
'see_del': 'view details',
|
||||||
'time': 'request time',
|
'time': 'request time',
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export default {
|
|||||||
'description': 'keterangan',
|
'description': 'keterangan',
|
||||||
'browser': 'peramban',
|
'browser': 'peramban',
|
||||||
'create_time': 'menciptakan waktu',
|
'create_time': 'menciptakan waktu',
|
||||||
|
'error_message': 'pesan kesalahan',
|
||||||
'err_del': 'detail pengecualian',
|
'err_del': 'detail pengecualian',
|
||||||
'see_del': 'melihat rincian',
|
'see_del': 'melihat rincian',
|
||||||
'time': 'waktu permintaan',
|
'time': 'waktu permintaan',
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export default {
|
|||||||
'description': '描述',
|
'description': '描述',
|
||||||
'browser': '浏览器',
|
'browser': '浏览器',
|
||||||
'create_time': '创建日期',
|
'create_time': '创建日期',
|
||||||
|
'error_message': '错误信息',
|
||||||
'err_del': '异常详情',
|
'err_del': '异常详情',
|
||||||
'see_del': '查看详情',
|
'see_del': '查看详情',
|
||||||
'time': '请求耗时',
|
'time': '请求耗时',
|
||||||
|
|||||||
Reference in New Issue
Block a user