@lvce-editor/extension-host-worker 5.7.0 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1833,6 +1833,17 @@ const getErrorType = prettyError => {
|
|
|
1833
1833
|
}
|
|
1834
1834
|
return undefined;
|
|
1835
1835
|
};
|
|
1836
|
+
const isAlreadyStack = line => {
|
|
1837
|
+
return line.trim().startsWith('at ');
|
|
1838
|
+
};
|
|
1839
|
+
const getStack = prettyError => {
|
|
1840
|
+
const stackString = prettyError.stack || '';
|
|
1841
|
+
const newLineIndex = stackString.indexOf('\n');
|
|
1842
|
+
if (newLineIndex !== -1 && !isAlreadyStack(stackString.slice(0, newLineIndex))) {
|
|
1843
|
+
return stackString.slice(newLineIndex + 1);
|
|
1844
|
+
}
|
|
1845
|
+
return stackString;
|
|
1846
|
+
};
|
|
1836
1847
|
const getErrorProperty = (error, prettyError) => {
|
|
1837
1848
|
if (error && error.code === E_COMMAND_NOT_FOUND) {
|
|
1838
1849
|
return {
|
|
@@ -1845,7 +1856,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
1845
1856
|
code: Custom,
|
|
1846
1857
|
message: prettyError.message,
|
|
1847
1858
|
data: {
|
|
1848
|
-
stack: prettyError
|
|
1859
|
+
stack: getStack(prettyError),
|
|
1849
1860
|
codeFrame: prettyError.codeFrame,
|
|
1850
1861
|
type: getErrorType(prettyError),
|
|
1851
1862
|
code: prettyError.code,
|