Skip to content

Commit

Permalink
core/utils/logger: Log FetchError's status (#2024)
Browse files Browse the repository at this point in the history
The standard serializer of Bunyan, our logging library, strips out
most attributes of logged errors which means we can miss some
important information when those include non standard attributes.

For example, the `status` attribute of `FetchError`s are stripped
out so we can't know the returned status of failed requests.
As we've done for other attributes, we add it back to the logged
object.
  • Loading branch information
taratatach authored Jan 29, 2021
1 parent ce0da21 commit d123cdd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/utils/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ function errSerializer(err) {
port,
syscall,
code,
status,
originalErr
} = err

Expand All @@ -95,6 +96,7 @@ function errSerializer(err) {
if (port) obj.port = port
if (syscall) obj.syscall = syscall
if (code) obj.code = code
if (status) obj.status = status
if (originalErr) obj.originalErr = originalErr

return obj
Expand Down

0 comments on commit d123cdd

Please sign in to comment.