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

Add error type and messages in Cardano.CLI.EraBased.Run #156

Merged
merged 1 commit into from
Aug 17, 2023

Conversation

carbolymer
Copy link
Contributor

@carbolymer carbolymer commented Aug 7, 2023

Changelog

- description: |
    Add error type and messages in `Cardano.CLI.EraBased.Run`.
# uncomment types applicable to the change:
  type:
  # - feature        # introduces a new feature
  # - breaking       # the API has changed in a breaking way
   - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  # - improvement    # QoL changes e.g. refactoring
  # - bugfix         # fixes a defect
   - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...

Context

n/a

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • The change log section in the PR description has been filled in
  • New tests are added if needed and existing tests are updated. These may include:
    • golden tests
    • property tests
    • round trip tests
    • integration tests
      See Running tests for more details
  • The version bounds in .cabal files are updated
  • CI passes. See note on CI. The following CI checks are required:
    • Code is linted with hlint. See .github/workflows/check-hlint.yml to get the hlint version
    • Code is formatted with stylish-haskell. See .github/workflows/stylish-haskell.yml to get the stylish-haskell version
    • Code builds on Linux, MacOS and Windows for ghc-8.10.7 and ghc-9.2.7
  • The changelog section in the PR is updated to describe the change
  • Self-reviewed the diff

@carbolymer carbolymer changed the title Initial commit Error type in Cardano.CLI.EraBased.Run Aug 7, 2023
@carbolymer carbolymer changed the title Error type in Cardano.CLI.EraBased.Run Add errors type in Cardano.CLI.EraBased.Run Aug 8, 2023
@carbolymer carbolymer force-pushed the mgalazyn/fix/errors-for-erabased-commands branch 4 times, most recently from 4d716d6 to afa82b9 Compare August 16, 2023 15:24
@carbolymer carbolymer force-pushed the mgalazyn/fix/errors-for-erabased-commands branch from afa82b9 to d943a09 Compare August 16, 2023 15:28
@carbolymer carbolymer changed the title Add errors type in Cardano.CLI.EraBased.Run Add error type and messages in Cardano.CLI.EraBased.Run Aug 16, 2023
@carbolymer carbolymer marked this pull request as ready for review August 16, 2023 15:29
@carbolymer carbolymer force-pushed the mgalazyn/fix/errors-for-erabased-commands branch 3 times, most recently from ced4540 to 26e6a5d Compare August 16, 2023 22:59
runEraBasedCommand = \case
EraBasedGovernanceCmds cmd -> runEraBasedGovernanceCmds cmd

runEraBasedGovernanceCmds :: ()
=> EraBasedGovernanceCmds era
-> ExceptT () IO ()
-> ExceptT AnyEraCmdError IO ()
Copy link
Contributor

Choose a reason for hiding this comment

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

Are the error types going to follow the command structure or are we doing one large sum type for all our errors?

Copy link
Contributor

@newhoggy newhoggy Aug 17, 2023

Choose a reason for hiding this comment

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

But I think we should not create a distinction between era-based command errors and legacy errors. We can actually share the same types, and in fact it's preferably because it means less changes when we move legacy stuff into era-based.

Copy link
Contributor

@newhoggy newhoggy Aug 17, 2023

Choose a reason for hiding this comment

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

I reckon we should call this type CmdError and put it in Cardano.CLI.EraBased.Error. Then the legacy code can use this type instead later instead of LegacyClientCmdError.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We already have ClientCommandErrors in Cardano.CLI.Run. Should we reuse this one as a top-level umbrella error type?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not yet. It includes lots of legacy stuff as members.

@newhoggy newhoggy self-requested a review August 17, 2023 08:07
@newhoggy newhoggy self-requested a review August 17, 2023 08:08
@carbolymer carbolymer force-pushed the mgalazyn/fix/errors-for-erabased-commands branch from 26e6a5d to 3c9a5d5 Compare August 17, 2023 08:54
@carbolymer carbolymer force-pushed the mgalazyn/fix/errors-for-erabased-commands branch from 3c9a5d5 to 780d376 Compare August 17, 2023 09:03
@carbolymer carbolymer requested review from a team as code owners August 17, 2023 09:03
@carbolymer carbolymer added this pull request to the merge queue Aug 17, 2023
@carbolymer carbolymer removed this pull request from the merge queue due to a manual request Aug 17, 2023
@carbolymer carbolymer merged commit 24b2cb9 into main Aug 17, 2023
@carbolymer carbolymer deleted the mgalazyn/fix/errors-for-erabased-commands branch August 17, 2023 14:26
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