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')
|
if (typeof value === 'bigint')
|
||||||
return { bi: value.toString() };
|
return { bi: value.toString() };
|
||||||
|
|
||||||
if (isError(value))
|
if (isError(value)) {
|
||||||
return { e: { n: value.name, m: value.message, s: value.stack || '' } };
|
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))
|
if (isDate(value))
|
||||||
return { d: value.toJSON() };
|
return { d: value.toJSON() };
|
||||||
if (isURL(value))
|
if (isURL(value))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue