Skip to content

Preserve message and name when logging Error instances#175

Merged
bert-e merged 2 commits into
development/8.2from
bugfix/WRLGS-19/errors
Jun 24, 2026
Merged

Preserve message and name when logging Error instances#175
bert-e merged 2 commits into
development/8.2from
bugfix/WRLGS-19/errors

Conversation

@maeldonn

Copy link
Copy Markdown
Contributor

JSON.stringify only walks enumerable own properties, so Error instances (whose message, name and stack are non-enumerable) serialize to {} or to a partial object when subclasses add own props. This regressed downstream logs after consumers picked up AWS SDK v3, whose errors are real Error subclasses (vs. SDK v2 which set message/code as enumerable own props).

Pass a JSON replacer in SimpleLogger.safeStringify that detects Error values and returns a plain object with message and name alongside any own enumerable props. Stack is intentionally omitted to keep log lines compact and match prior behavior.

Add unit tests covering plain Error, Error subclasses with own props, nested Errors, non-Error passthrough, and absence of stack.

Issue: WRLGS-19

JSON.stringify only walks enumerable own properties, so Error instances
(whose message, name and stack are non-enumerable) serialize to {} or to
a partial object when subclasses add own props. This regressed
downstream logs after consumers picked up AWS SDK v3, whose errors are
real Error subclasses (vs. SDK v2 which set message/code as enumerable
own props).

Pass a JSON replacer in SimpleLogger.safeStringify that detects Error
values and returns a plain object with message and name alongside any
own enumerable props. Stack is intentionally omitted to keep log lines
compact and match prior behavior.

Add unit tests covering plain Error, Error subclasses with own props,
nested Errors, non-Error passthrough, and absence of stack.

Issue: WRLGS-19
@maeldonn maeldonn requested review from a team, DarkIsDude and SylvainSenechal June 24, 2026 09:42
@bert-e

bert-e commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Hello maeldonn,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval
/bypass_build_status Bypass the build and test status
/bypass_commit_size Bypass the check on the size of the changeset TBA
/bypass_incompatible_branch Bypass the check on the source branch prefix
/bypass_jira_check Bypass the Jira issue check
/bypass_peer_approval Bypass the pull request peers' approval
/bypass_leader_approval Bypass the pull request leaders' approval
/approve Instruct Bert-E that the author has approved the pull request. ✍️
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request TBA
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@scality scality deleted a comment from bert-e Jun 24, 2026
@bert-e

bert-e commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • 2 peers

@maeldonn

Copy link
Copy Markdown
Contributor Author

/approve

@bert-e

bert-e commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

I have successfully merged the changeset of this pull request
into targetted development branches:

  • ✔️ development/8.2

The following branches have NOT changed:

  • development/6.4
  • development/7.10
  • development/7.4
  • development/8.0
  • development/8.1

This pull request did not target the following hotfix branch(es) so they
were left untouched:

  • hotfix/7.10.4
  • hotfix/7.4.3
  • hotfix/7.10.0
  • hotfix/7.4.7
  • hotfix/7.4.4
  • hotfix/7.4.10
  • hotfix/7.4.8
  • hotfix/7.4.9
  • hotfix/7.6.0
  • hotfix/7.4.1
  • hotfix/7.10.3
  • hotfix/7.4.2
  • hotfix/7.10.2
  • hotfix/6.4.7
  • hotfix/7.9.0
  • hotfix/8.1.0
  • hotfix/7.10.1
  • hotfix/7.4.0
  • hotfix/7.2.0
  • hotfix/7.7.0
  • hotfix/7.4.6
  • hotfix/7.8.0
  • hotfix/7.4.5

Please check the status of the associated issue WRLGS-19.

Goodbye maeldonn.

The following options are set: approve

@bert-e bert-e merged commit a7bbb59 into development/8.2 Jun 24, 2026
1 check passed
@bert-e bert-e deleted the bugfix/WRLGS-19/errors branch June 24, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants