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

feat: add either.AsyncErr type & helpers #115

Merged
merged 2 commits into from
Oct 30, 2023
Merged

Conversation

bryanchriswhite
Copy link
Contributor

@bryanchriswhite bryanchriswhite commented Oct 30, 2023

Summary

Human Summary

Adds the either.AsyncError type (i.e. either.Either[chan error]) as well as helper methods, analogous to either.Either`'s:

  • SyncErr(err error) either.AsyncError
  • AsyncErr(errCh chan error) AsyncError
  • AsyncError#SyncOrAsyncError() (error, chan error)
  • AsyncError#IsSyncError() bool
  • AsyncError#IsAsyncError() bool

AI Summary

Summary generated by Reviewpad on 30 Oct 23 22:37 UTC

This pull request includes two patches.

The first patch adds the either.AsyncErr type and helper functions to the package either. It introduces the SyncErr function, which creates an AsyncError from a synchronous error, and the AsyncErr function, which creates an AsyncError from an error channel. It also includes functions to decompose the AsyncError into its components and check if it represents a synchronous or asynchronous error.

The second patch fixes a comment typo in the SyncErr function in the errors.go file of the either package.

Overall, this pull request enhances the either package by adding a new type and helper functions and fixing a comment typo.

Issue

Relates to:

  1. Adds API for convenience when working with either objects in context where both a synchronous and asynchronous error are in scope.
  2. Improves readability in such places.

Type of change

Select one or more:

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Documentation
  • Other (specify)

Testing

  • Run all unit tests: make go_develop_and_test
  • Verify Localnet manually: See the instructions [here](TODO: add link to instructions)

Sanity Checklist

  • I have tested my changes using the available tooling
  • I have performed a self-review of my own code
  • I have commented my code, updated documentation and left TODOs throughout the codebase

@bryanchriswhite bryanchriswhite added miner Changes related to the Miner off-chain Off-chain business logic labels Oct 30, 2023
@bryanchriswhite bryanchriswhite added this to the Shannon TestNet milestone Oct 30, 2023
@bryanchriswhite bryanchriswhite self-assigned this Oct 30, 2023
@bryanchriswhite bryanchriswhite marked this pull request as ready for review October 30, 2023 21:34
pkg/either/errors.go Outdated Show resolved Hide resolved
Co-authored-by: Daniel Olshansky <[email protected]>
@bryanchriswhite bryanchriswhite merged commit 2fb66bc into main Oct 30, 2023
@bryanchriswhite bryanchriswhite deleted the feat/either-errors branch October 30, 2023 22:37
bryanchriswhite added a commit that referenced this pull request Oct 31, 2023
* pokt/main:
  refactor: add `either.Bytes` alias (#117)
  feat: add either.AsyncErr type & helpers (#115)
Olshansk added a commit that referenced this pull request Oct 31, 2023
* feat: add either.AsyncErr type & helpers

* fix: comment typo

Co-authored-by: Daniel Olshansky <[email protected]>

---------

Co-authored-by: Daniel Olshansky <[email protected]>
bryanchriswhite added a commit that referenced this pull request Nov 7, 2023
…plementation

* pokt/main: (28 commits)
  [Miner] feat: add supplier client (#42)
  [Off-chain] refactor: keyring errors & helpers (#131)
  [Miner] feat: add `TxClient` (#94)
  [CI] Build container images (#107)
  fix: flaky block client test (#132)
  [Tooling] add `go_lint` & `go_imports` make targets & CI step (#129)
  Update README.md
  [Code Health] Support `godoc` by replacing the `pocket `module name with `github.com/pokt-network/poktroll` (#128)
  [Miner] feat: add `TxContext` (#118)
  [Testing] fix: flaky tests in observable & client pkgs (#124)
  Added first roadmap change
  [AppGate] Implement UndelegateFromGateway with Extensive Tests (#125)
  [Miner] feat: add block client (#65)
  [Supplier] Add `ServiceConfigs` to `SupplierStaking` (#114)
  [AppGate] Add the MaxDelegatedGateways parameter (#109)
  [Test] Temporarily skip a flaky test `TestEventsQueryClient_Subscribe_Succeeds` (#121)
  [AppGate] Implement DelegateToGateway and add Tests (#90)
  [E2E] Add (Un)Stake Tests (#88)
  refactor: add `either.Bytes` alias (#117)
  feat: add either.AsyncErr type & helpers (#115)
  ...
okdas pushed a commit that referenced this pull request Nov 14, 2024
* feat: add either.AsyncErr type & helpers

* fix: comment typo

Co-authored-by: Daniel Olshansky <[email protected]>

---------

Co-authored-by: Daniel Olshansky <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
miner Changes related to the Miner off-chain Off-chain business logic
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants