Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change how IsErrorCode check error with errors.As #40

Merged
merged 1 commit into from
Jan 20, 2024

Conversation

panotza
Copy link
Contributor

@panotza panotza commented Jan 19, 2024

This pull request attempts to address an edge case where IsErrorCode receives a wrapped error. For example, the 'ent' package returns an error like this:

if err := c.batchInsert(ctx, tx, insert); err != nil {
    return fmt.Errorf("insert nodes to table %q: %w", c.Nodes[0].Table, err)
}

It is necessary to use errors.As to properly check if the error can be cast to the sqlState interface or not.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a6be916) 77.92% compared to head (2e4e98a) 77.96%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #40      +/-   ##
==========================================
+ Coverage   77.92%   77.96%   +0.04%     
==========================================
  Files          22       22              
  Lines        1327     1330       +3     
==========================================
+ Hits         1034     1037       +3     
  Misses        270      270              
  Partials       23       23              

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

@acoshift acoshift self-requested a review January 20, 2024 01:59
@acoshift acoshift merged commit 47d11e1 into acoshift:master Jan 20, 2024
4 checks passed
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.

3 participants