Skip to content

Commit

Permalink
Potential fix for #96
Browse files Browse the repository at this point in the history
  • Loading branch information
withmask committed Apr 8, 2021
1 parent b86b855 commit aae149b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"devDependencies": {
"@microsoft/api-extractor": "^7.13.2",
"@rushstack/eslint-config": "^2.3.2",
"@typescript-eslint/types": "^4.21.0",
"@types/jest": "^26.0.20",
"@types/node": "^14.14.33",
"@types/source-map-support": "^0.5.3",
Expand Down
17 changes: 9 additions & 8 deletions src/LoggerWithoutCallSite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,14 +455,15 @@ export class LoggerWithoutCallSite {
relevantCallSites.length = stackLimit;
}

const errorObject: IErrorObject = (LoggerHelper.cloneObjectRecursively(
error
) as unknown) as IErrorObject;
errorObject.nativeError = error;
errorObject.details = { ...error };
errorObject.name = errorObject.name ?? "Error";
errorObject.isError = true;
errorObject.stack = this._toStackObjectArray(relevantCallSites);
const errorObject: IErrorObject = {
nativeError: error,
details: { ...error },
name: error.name ?? "Error",
isError: true,
message: error.message,
stack: this._toStackObjectArray(relevantCallSites),
};

if (errorObject.stack.length > 0) {
const errorCallSite: IStackFrame = LoggerHelper.toStackFrameObject(
this._callSiteWrapper(relevantCallSites[0])
Expand Down

0 comments on commit aae149b

Please sign in to comment.