Bug: [BUG] Cannot read properties of undefined (reading 'map') at prettyFormatErrorObj
#311
Labels
bug
Something isn't working
Describe the bug
a undefined not handle by
prettyFormatErrorObj
then call thegetErrorTrace
.Screenshots
To Reproduce
this is a large project, so i checked into the code. and finded the bug.
the error throw from this line :
tslog/src/runtime/nodejs/index.ts
Line 129 in 9a5d156
it tell me
Cannot read properties of undefined (reading 'map') at prettyFormatErrorObj
.so , we can kwon that , the return of
getErrorTrace()
is undefined .when we see the function
getErrorTrace()
we can find that :tslog/src/runtime/nodejs/index.ts
Lines 64 to 71 in 9a5d156
the function
getErrorTrace()
is returnundefined | IStackFrame[]
notIStackFrame[]
.because the function use
?.
chain .and after i search all code , i find that the browser version code was fixed this issue.
tslog/src/runtime/browser/index.ts
Lines 64 to 72 in 9a5d156
it fix by a
?? []
simply .Expected behavior
simple write code like browser , then all will work.
the right code maybe like here :
Node.js Version
v20.12.2
OS incl. Version
win10
The text was updated successfully, but these errors were encountered: