Skip to content

Conversation

@erka
Copy link
Member

@erka erka commented Oct 15, 2025

This PR

  • add the ability to preserve original errors in general ResolutionError. This enables providers to wrap underlying errors while maintaining backward compatibility, allowing callers to use errors.Is() and errors.As() for error inspection.

Related Issues

#437

Add the ability to preserve original errors in ResolutionError.
This enables providers to wrap underlying errors while maintaining
backward compatibility, allowing callers to use errors.Is() and
errors.As() for error inspection.

Signed-off-by: Roman Dmytrenko <[email protected]>
@erka erka requested review from a team as code owners October 15, 2025 13:44
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @erka, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces robust error wrapping capabilities to the ResolutionError type. By adding an originalErr field and implementing the Unwrap() method, it allows the preservation of underlying errors. This enhancement is crucial for providers to maintain backward compatibility while offering more detailed error information, and it enables consumers to perform sophisticated error inspection using standard Go error handling functions like errors.Is() and errors.As().

Highlights

  • Error Wrapping Support: The ResolutionError type now supports error wrapping, allowing underlying errors to be preserved.
  • Backward Compatibility: This change ensures that providers can wrap errors while maintaining backward compatibility for existing consumers.
  • Enhanced Error Inspection: Callers can now utilize Go's errors.Is() and errors.As() functions to inspect and identify specific wrapped errors.
  • New Constructor Parameter: The NewGeneralResolutionError constructor has been updated to accept an optional variadic parameter for original errors.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link

codecov bot commented Oct 15, 2025

Codecov Report

❌ Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.89%. Comparing base (40fe27e) to head (3219d21).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
openfeature/resolution_error.go 89.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #438      +/-   ##
==========================================
+ Coverage   85.57%   85.89%   +0.31%     
==========================================
  Files          20       20              
  Lines        1435     1446      +11     
==========================================
+ Hits         1228     1242      +14     
+ Misses        186      183       -3     
  Partials       21       21              
Flag Coverage Δ
e2e 85.89% <89.47%> (+0.31%) ⬆️
unit 85.89% <89.47%> (+0.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces error wrapping for ResolutionError, which is a valuable enhancement for debugging and error inspection. The changes are well-contained and include corresponding tests. I have two suggestions to further refine the implementation. The first is to enhance the Error() method to include details from the wrapped error, making error messages more informative. The second is to simplify the NewGeneralResolutionError constructor by fully utilizing errors.Join, which will make the code more concise and idiomatic.

Signed-off-by: Roman Dmytrenko <[email protected]>
@sahidvelji sahidvelji linked an issue Oct 15, 2025 that may be closed by this pull request
@sahidvelji
Copy link
Contributor

Should we do something similar for NewParseErrorResolutionError as well?

Signed-off-by: Roman Dmytrenko <[email protected]>
@erka
Copy link
Member Author

erka commented Oct 15, 2025

Yeah, that’s a great suggestion. @sahidvelji

@sahidvelji sahidvelji merged commit 1c624c9 into open-feature:main Oct 15, 2025
6 checks passed
@erka erka deleted the rd/original-err branch October 16, 2025 10:45
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.

[BUG] errors.Is cannot detect original cause

3 participants