Skip to content

Commit 6005942

Browse files
committed
small fix weeee
1 parent b1e855b commit 6005942

3 files changed

Lines changed: 11 additions & 25 deletions

File tree

package-lock.json

Lines changed: 1 addition & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/json-circular.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const stringify = (obj, processed, path = '') => {
99
try {
1010
if (typeof obj !== 'object') return JSON.stringify(obj);
1111
// error doesnt stringify correctly, manually include key fields like being an error
12-
if (obj instanceof Error) return `{"t":"e","v":{"name":${JSON.stringify(obj.name)},"message":${JSON.stringify(obj.message)},"stack":${JSON.stringify(obj.stack)},"cause":${JSON.stringify(obj.cause)}}}`;
12+
if (obj instanceof Error) return `{"t":"e","v":{"name":${JSON.stringify(obj.name) ?? 'null'},"message":${JSON.stringify(obj.message) ?? 'null'},"stack":${JSON.stringify(obj.stack) ?? 'null'},"cause":${JSON.stringify(obj.cause) ?? 'null'}}}`;
1313
if (obj === null) return 'null';
1414
processed ??= [];
1515
processed.push([path, obj]);

src/lib/pm-log-capture.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,18 @@ const downloadLogs = async () => {
150150
const files = new JSZip();
151151
files.file('logs.json', stringify(consoleLogs));
152152
const index = {};
153+
const messages = [
154+
...consoleLogs,
155+
...consoleLogs
156+
.map(log => log.message)
157+
.flat()
158+
.filter(arg => arg instanceof Error)
159+
.map(error => (error.trace = parseStack(error.stack), error))
160+
];
153161
// get files
154162
// sadly, this may just dead ass fail to get files due to blob lifecycle
155163
// and i dont want to make these files get stored at runtime, cause poopy doo doo ram
156-
for (const log of consoleLogs) {
164+
for (const log of messages) {
157165
for (const trace of log.trace) {
158166
if (index[trace.url]) continue;
159167
const id = uid();

0 commit comments

Comments
 (0)