提交 32c1657e 编写于 作者: D DCloud_LXH

chore: uni-stacktracey parse error return original

上级 cf98a7a4
......@@ -181,6 +181,9 @@ class StackTracey {
const trimEnd = (s, n) => s && (s.length > n ? s.slice(0, n - 1) + '' : s);
const trimStart = (s, n) => s && (s.length > n ? '' + s.slice(-(n - 1)) : s);
function parseItem(e, maxColumnWidths, isMP) {
if (!e.parsed) {
return e.beforeParse;
}
const filePath = (isMP ? e.file && e.file : e.fileShort && e.fileShort) +
`${e.line ? ':' + e.line : ''}` +
`${e.column ? ':' + e.column : ''}`;
......@@ -236,6 +239,7 @@ function stacktracey(stacktrace, opts) {
fileRelative: source,
fileName,
thirdParty: isThirdParty(sourcePath),
parsed: true,
});
/**
* 以 .js 结尾
......@@ -357,6 +361,9 @@ function parseSourceMapContent(consumer, obj) {
}
}
function joinItem(item) {
if (typeof item === 'string') {
return item;
}
const a = item[0];
const b = item[1] ? ` ${item[1]}` : '';
const c = item[2] ? ` ${item[2]}` : '';
......
......@@ -173,6 +173,9 @@ class StackTracey {
const trimEnd = (s, n) => s && (s.length > n ? s.slice(0, n - 1) + '' : s);
const trimStart = (s, n) => s && (s.length > n ? '' + s.slice(-(n - 1)) : s);
function parseItem(e, maxColumnWidths, isMP) {
if (!e.parsed) {
return e.beforeParse;
}
const filePath = (isMP ? e.file && e.file : e.fileShort && e.fileShort) +
`${e.line ? ':' + e.line : ''}` +
`${e.column ? ':' + e.column : ''}`;
......@@ -238,6 +241,7 @@ function stacktracey(stacktrace, opts) {
fileRelative: source,
fileName,
thirdParty: isThirdParty(sourcePath),
parsed: true,
});
/**
* 以 .js 结尾
......@@ -359,6 +363,9 @@ function parseSourceMapContent(consumer, obj) {
}
}
function joinItem(item) {
if (typeof item === 'string') {
return item;
}
const a = item[0];
const b = item[1] ? ` ${item[1]}` : '';
const c = item[2] ? ` ${item[2]}` : '';
......
......@@ -134,6 +134,7 @@ export function stacktracey(
fileRelative: source,
fileName,
thirdParty: isThirdParty(sourcePath),
parsed: true,
})
/**
......@@ -290,7 +291,10 @@ interface UniStracktraceyPresetOptions {
uniPlatform?: string
}
function joinItem(item: string[]) {
function joinItem(item: string[] | string) {
if (typeof item === 'string') {
return item
}
const a = item[0]
const b = item[1] ? ` ${item[1]}` : ''
const c = item[2] ? ` ${item[2]}` : ''
......
......@@ -248,6 +248,9 @@ function parseItem(
maxColumnWidths: StackTracey.MaxColumnWidths,
isMP: boolean
) {
if (!e.parsed) {
return e.beforeParse
}
const filePath =
(isMP ? e.file && e.file : e.fileShort && e.fileShort) +
`${e.line ? ':' + e.line : ''}` +
......@@ -305,6 +308,8 @@ declare namespace StackTracey {
error?: Error
line?: number
column?: number
parsed?: boolean
}
interface MaxColumnWidths {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册