Skip to content

Conversation

@mormubis
Copy link
Contributor

@mormubis mormubis commented Sep 19, 2025

Motivation

Fixes #3839

Changes

If the cause of an error is non-error, it will retrieve the same information as addError(error.cause) and add it to the causes.

Test instructions

All tests passed.

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.

@datadog-official
Copy link

datadog-official bot commented Sep 19, 2025

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage
Patch Coverage: 100.00%
Total Coverage: 92.68% (+0.00%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 763bee7 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@cit-pr-commenter
Copy link

cit-pr-commenter bot commented Sep 19, 2025

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 164.13 KiB 164.28 KiB +158 B +0.09%
Rum Profiler 4.84 KiB 4.84 KiB 0 B 0.00%
Rum Recorder 19.62 KiB 19.62 KiB 0 B 0.00%
Logs 55.91 KiB 56.07 KiB +165 B +0.29%
Flagging 944 B 944 B 0 B 0.00%
Rum Slim 121.39 KiB 121.56 KiB +165 B +0.13%
Worker 23.63 KiB 23.63 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base CPU Time (ms) Local CPU Time (ms) 𝚫%
RUM - add global context 0.0052 0.0045 -13.46%
RUM - add action 0.0166 0.0135 -18.67%
RUM - add error 0.0123 0.014 +13.82%
RUM - add timing 0.0038 0.0038 0.00%
RUM - start view 0.0043 0.0041 -4.65%
RUM - start/stop session replay recording 0.0007 0.001 +42.86%
Logs - log message 0.0153 0.0163 +6.54%
🧠 Memory Performance
Action Name Base Memory Consumption Local Memory Consumption 𝚫
RUM - add global context 25.97 KiB 26.13 KiB +155 B
RUM - add action 48.71 KiB 49.30 KiB +604 B
RUM - add timing 24.62 KiB 23.98 KiB -660 B
RUM - add error 54.02 KiB 56.98 KiB +2.96 KiB
RUM - start/stop session replay recording 24.42 KiB 24.00 KiB -432 B
RUM - start view 424.89 KiB 423.04 KiB -1.86 KiB
Logs - log message 46.09 KiB 43.59 KiB -2.50 KiB

🔗 RealWorld

@mormubis mormubis changed the title 🐛 add support for arbitrary causes 🐛 add support for arbitrary Error causes Sep 19, 2025
@mormubis
Copy link
Contributor Author

/to-staging

@dd-devflow-routing-codex
Copy link

dd-devflow-routing-codex bot commented Sep 19, 2025

View all feedbacks in Devflow UI.

2025-09-19 13:30:50 UTC ℹ️ Start processing command /to-staging


2025-09-19 13:30:58 UTC ℹ️ Branch Integration: starting soon, merge expected in approximately 13m (p90)

Commit 73dedf8cc3 will soon be integrated into staging-38.


2025-09-19 13:44:44 UTC ℹ️ Branch Integration: this commit was successfully integrated

Commit 73dedf8cc3 has been merged into staging-38 in merge commit 18489a1875.

Check out the triggered pipeline on Gitlab 🦊

If you need to revert this integration, you can use the following command: /code revert-integration -b staging-38

dd-mergequeue bot added a commit that referenced this pull request Sep 19, 2025
Integrated commit sha: 73dedf8

Co-authored-by: mormubis <adrian.delarosa@datadoghq.com>
@mormubis mormubis marked this pull request as ready for review November 27, 2025 08:39
@mormubis mormubis requested a review from a team as a code owner November 27, 2025 08:39
const causes = flattenErrorCauses(error, ErrorSource.CUSTOM)
expect(causes?.length).toBe(1)
expect(causes?.[0]).toEqual({
message: '"string cause"', // JSON stringified
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 suggestion: ‏For reporting thrown string we also stringify the message since we add a prefix the quotes act like a separator, ex: Uncaught "string cause".
Not sure the quotes add much value in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to affect how they look in the UI. Also, it improves the readability when they are objects.

Thoughts?

})
})

it('should stop chain after non-Error cause', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ question: ‏that sounds ok to me but I wonder if it is a choice you made or if it is based on spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no specifications regarding how to handle complaint objects that are not errors. I made this decision to prevent a plain object with a cause field from causing any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Error: cause assumed as an error.

4 participants