Skip to content

Commit bd12cf0

Browse files
committed
Fixing linter errors
1 parent 60db06c commit bd12cf0

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/logger/index.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,18 @@ function removeCircular(obj: any, refs: Set<any> = new Set()): any {
7272
returnObj = {};
7373
}
7474
for (const k in obj) {
75-
try {
76-
if (refs.has(obj[k])) {
77-
returnObj[k] = "[Circular]";
78-
} else {
79-
returnObj[k] = removeCircular(obj[k], refs);
75+
if (obj.hasOwnProperty(k)) {
76+
try {
77+
if (refs.has(obj[k])) {
78+
returnObj[k] = "[Circular]";
79+
} else {
80+
returnObj[k] = removeCircular(obj[k], refs);
81+
}
82+
} catch {
83+
returnObj[k] = "[Error - cannot serialize]";
8084
}
81-
} catch {
82-
returnObj[k] = "[Error - cannot serialize]";
85+
} else {
86+
returnObj[k] = "[Error - defined in the prototype but missing in the object]";
8387
}
8488
}
8589
refs.delete(obj);

0 commit comments

Comments
 (0)