mirror of
https://github.com/microsoft/playwright.git
synced 2024-09-11 20:37:54 +03:00
This brings stack formatting to how it was prior to
1686e5174d
so that the ports can use it.
This commit is contained in:
parent
7c55b94280
commit
edb89dcb66
@ -170,8 +170,16 @@ export function source() {
|
||||
if (typeof value === 'bigint')
|
||||
return { bi: value.toString() };
|
||||
|
||||
if (isError(value))
|
||||
return { e: { n: value.name, m: value.message, s: value.stack || '' } };
|
||||
if (isError(value)) {
|
||||
let stack;
|
||||
if (value.stack?.startsWith(value.name + ': ' + value.message)) {
|
||||
// v8
|
||||
stack = value.stack;
|
||||
} else {
|
||||
stack = `${value.name}: ${value.message}\n${value.stack}`;
|
||||
}
|
||||
return { e: { n: value.name, m: value.message, s: stack } };
|
||||
}
|
||||
if (isDate(value))
|
||||
return { d: value.toJSON() };
|
||||
if (isURL(value))
|
||||
|
Loading…
Reference in New Issue
Block a user