Skip to content

Commit

Permalink
FIX: case where context is {err}
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael O'Brien committed Aug 18, 2023
1 parent 1313e10 commit 56c252a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [16.x]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"args": [
"--runInBand",
"--watchAll=false",
"destinations"
"excep"
]
}
]
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,13 @@ export default class SenseLogs {
exception = {code: context.err.code, message: context.err.message, stack: context.err.stack}
if (Object.keys(context).length == 1) {
// {err} is only context, so hoist
ctx = context.err
ctx = exception
} else {
delete ctx.err
}
}
if (exception) {
// Error objects are not enumerable by JSON. Convert here and convert stack backtraces to arrays for formatting.
// Error objects are not enumerable by JSON. Convert stack backtraces to arrays for formatting.
let err = (ctx['@exception'] = JSON.parse(
JSON.stringify(exception, Object.getOwnPropertyNames(exception)),
null,
Expand Down

0 comments on commit 56c252a

Please sign in to comment.