Skip to content

Conversation

giortzisg
Copy link
Contributor

@giortzisg giortzisg commented Sep 4, 2025

Description

This PR adds support for capturing all possible errors (including wrapped ones) in Go. The following changes were made:

  • add support for unwrapping errors that implement the Unwrap() []error interface, by parsing all errors in a dfs-like traversal.
  • properly handle is_exception_group. In the end made the decision to only capture Unwrap() []error errors as exception_groups. This breaks the previous behavior of including any chained error in a group.
  • support for third party libraries using Cause() error.
  • change the default maxErrorDepth to 100.

maxErrorDepth

For the change to the default after a quick investigation these are some rough payload sizes based on the amount of errors that get unwrapped. Setting it to 100 since the payload sizes are not that big to cause any issues.

Built-in errors

Depth max=unlimited max=1 max=5 max=10 max=20
1 0.5KB 0.5KB 0.5KB 0.5KB 0.5KB
3 0.8KB 0.6KB 0.8KB 0.8KB 0.8KB
5 1.2KB 0.6KB 1.2KB 1.2KB 1.2KB
10 2.3KB 0.6KB 1.2KB 2.3KB 2.3KB
20 5.1KB 0.6KB 1.2KB 2.3KB 5.1KB
50 19.4KB 0.6KB 1.2KB 2.3KB 5.1KB
100 62.9KB 0.6KB 1.2KB 2.3KB 5.1KB

Third-party pkg/errors

Depth max=unlimited max=1 max=5 max=10 max=20
1 0.9KB 0.9KB 0.9KB 0.9KB 0.9KB
3 2.6KB 1.0KB 2.6KB 2.6KB 2.6KB
5 4.3KB 1.0KB 2.6KB 4.3KB 4.3KB
10 8.8KB 1.0KB 2.6KB 4.5KB 8.8KB
20 19.3KB 1.0KB 2.6KB 4.5KB 9.1KB
50 62.4KB 1.0KB 2.6KB 4.5KB 9.1KB
100 173.6KB 1.0KB 2.7KB 4.6KB 9.1KB

Issues

Copy link

codecov bot commented Sep 4, 2025

Codecov Report

❌ Patch coverage is 95.83333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.93%. Comparing base (49d29a6) to head (359870d).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
exception.go 96.15% 2 Missing and 1 partial ⚠️
interfaces.go 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1075      +/-   ##
==========================================
- Coverage   87.00%   86.93%   -0.07%     
==========================================
  Files          55       57       +2     
  Lines        6077     6132      +55     
==========================================
+ Hits         5287     5331      +44     
- Misses        645      653       +8     
- Partials      145      148       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@giortzisg giortzisg marked this pull request as ready for review September 10, 2025 11:44
@giortzisg giortzisg requested a review from cleptric September 10, 2025 11:44
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@cleptric cleptric added the Feature Issue type label Sep 10, 2025
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@giortzisg giortzisg force-pushed the feat/issue-grouping branch from 2b77a8e to e852a0f Compare October 1, 2025 14:23
cursor[bot]

This comment was marked as outdated.

Copy link
Member

@lcian lcian left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for bearing with me.
Left some more nits that you can also disregard.
Issue Grouping changes should be documented in the changelog.

@giortzisg giortzisg changed the title support errors.Join for exception groups feat: properly support error capturing Oct 2, 2025
Copy link

linear bot commented Oct 2, 2025

cursor[bot]

This comment was marked as outdated.

@giortzisg giortzisg force-pushed the feat/issue-grouping branch from 02fd170 to 533a87d Compare October 2, 2025 14:09
@giortzisg giortzisg merged commit 99cebd5 into master Oct 14, 2025
18 checks passed
@giortzisg giortzisg deleted the feat/issue-grouping branch October 14, 2025 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Issue type

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decompose errors.Join errors in SetException

3 participants