Skip to content

Conversation

SuperFluffy
Copy link
Contributor

@SuperFluffy SuperFluffy commented Aug 14, 2025

codex::Error in its current form does not allow the thiserror::Error proc macro to establish a source-chain. The Display impl generated by it will only emit the top level error and drop all underlying errors.

To allow it to establish a source chain the field needs to be either tagged #[source] or the field named source: UnderlyingError. (or tag it [#from], but the very desirable context info does not allow for that)

I have opted to tag the field #[source] to mimimize churn. The Source({1}) was also removed because the intended way to access the underlying information is via std::error::Error::source. And because having Source({1}) would yield to duplicate messages both at error levels 0 and 1.

@patrick-ogrady patrick-ogrady requested a review from Copilot August 14, 2025 17:22
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves error handling in the codec module by enabling proper error source chain access through the thiserror::Error proc macro. The change allows the underlying error information to be accessed via the standard std::error::Error::source method rather than being embedded in the display string.

  • Modified the Wrapped error variant to use #[source] attribute for proper error chaining
  • Updated the error message format to remove duplicate source information
  • Maintains the same underlying error data while improving accessibility

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copy link
Contributor

@patrick-ogrady patrick-ogrady left a comment

Choose a reason for hiding this comment

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

❤️

@patrick-ogrady patrick-ogrady merged commit 52c04a9 into commonwarexyz:main Aug 17, 2025
33 checks passed
Copy link

codecov bot commented Aug 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@3d7581f). Learn more about missing BASE report.
⚠️ Report is 1 commits behind head on main.

@@           Coverage Diff           @@
##             main    #1402   +/-   ##
=======================================
  Coverage        ?   91.72%           
=======================================
  Files           ?      275           
  Lines           ?    69392           
  Branches        ?        0           
=======================================
  Hits            ?    63651           
  Misses          ?     5741           
  Partials        ?        0           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3d7581f...8466749. Read the comment docs.

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

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.

2 participants