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

[Merged by Bors] - chore: Fix errors.As usage for PoetSvcUnstableError #6217

Closed
wants to merge 1 commit into from

Conversation

fasmat
Copy link
Member

@fasmat fasmat commented Aug 6, 2024

Motivation

errors.Is is generally used to compare returned errors to a concrete instance of an error like fs.ErrNotExists or io.EOF, while errors.As is used to assign generic errors to an instance of a specific type if needed.

Description

This removes the Is method from PoetSvcUnstableError and replaces usages of it with errors.As, which is already facilitated by the custom Unwrap method if needed.

This also removes the dummy instance ErrPoetServiceUnstable that primarily exists to assert that an error is of the type PoetSvcUnstableError.

Test Plan

  • existing tests pass

TODO

  • Explain motivation or link existing issue(s)
  • Test changes and document test plan
  • Update documentation as needed
  • Update changelog as needed

Copy link

codecov bot commented Aug 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.0%. Comparing base (dc5fcaf) to head (42c7a19).

Additional details and impacted files
@@            Coverage Diff            @@
##           develop   #6217     +/-   ##
=========================================
- Coverage     82.0%   82.0%   -0.1%     
=========================================
  Files          308     308             
  Lines        33905   33906      +1     
=========================================
- Hits         27812   27807      -5     
- Misses        4318    4323      +5     
- Partials      1775    1776      +1     

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

@fasmat
Copy link
Member Author

fasmat commented Aug 6, 2024

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request Aug 6, 2024
## Motivation

`errors.Is` is generally used to compare returned errors to a concrete instance of an error like `fs.ErrNotExists` or `io.EOF`, while `errors.As` is used to assign generic errors to an instance of a specific type if needed.
@spacemesh-bors
Copy link

spacemesh-bors bot commented Aug 6, 2024

Pull request successfully merged into develop.

Build succeeded:

@spacemesh-bors spacemesh-bors bot changed the title chore: Fix errors.As usage for PoetSvcUnstableError [Merged by Bors] - chore: Fix errors.As usage for PoetSvcUnstableError Aug 6, 2024
@spacemesh-bors spacemesh-bors bot closed this Aug 6, 2024
@spacemesh-bors spacemesh-bors bot deleted the use-errors-as branch August 6, 2024 13:58
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