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

Replace panic with exceptions #1471

Merged
merged 12 commits into from
Aug 10, 2023
Merged

Replace panic with exceptions #1471

merged 12 commits into from
Aug 10, 2023

Conversation

Cmdv
Copy link
Contributor

@Cmdv Cmdv commented Jul 26, 2023

Description

Replacing panic with exceptions and better error messages/types.

There are still some panic's left in the project in :
./cardano-smash-server/
./cardano-chain-gen/

But the all have been replaced in ./cardano-db-sync/

fixes #1459

Checklist

  • Commit sequence broadly makes sense
  • Commits have useful messages
  • New tests are added if needed and existing tests are updated
  • Any changes are noted in the changelog
  • Code is formatted with fourmolu on version 0.10.1.0 (which can be run with scripts/fourmolize.sh)
  • Self-reviewed the diff

Migrations

  • The pr causes a breaking change of type a,b or c
  • If there is a breaking change, the pr includes a database migration and/or a fix process for old values, so that upgrade is possible
  • Resyncing and running the migrations provided will result in the same database semantically

If there is a breaking change, especially a big one, please add a justification here. Please elaborate
more what the migration achieves, what it cannot achieve or why a migration is not possible.

@Cmdv Cmdv force-pushed the 1459-replace-panic-with-exceptions branch from 61672f7 to a67640d Compare August 3, 2023 10:43
@Cmdv Cmdv marked this pull request as ready for review August 4, 2023 14:34
@Cmdv Cmdv requested review from a team as code owners August 4, 2023 14:34
@Cmdv Cmdv removed the request for review from a team August 7, 2023 21:40
Copy link
Contributor

@kderme kderme left a comment

Choose a reason for hiding this comment

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

Looks good! Just a few comments

cardano-db-sync/src/Cardano/DbSync/Error.hs Outdated Show resolved Hide resolved
cardano-db-sync/src/Cardano/DbSync/Ledger/State.hs Outdated Show resolved Hide resolved
cardano-db/src/Cardano/Db/Multiplex.hs Outdated Show resolved Hide resolved
cardano-smash-server/src/Cardano/SMASH/Server/Types.hs Outdated Show resolved Hide resolved
cardano-db-sync/src/Cardano/DbSync/Error.hs Show resolved Hide resolved
Copy link
Contributor

@sgillespie sgillespie left a comment

Choose a reason for hiding this comment

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

Well done! I've added a few comments and questions

cardano-db/src/Cardano/Db/Error.hs Show resolved Hide resolved
cardano-db-sync/src/Cardano/DbSync/Error.hs Outdated Show resolved Hide resolved
cardano-db-sync/src/Cardano/DbSync/Sync.hs Outdated Show resolved Hide resolved
cardano-db-sync/src/Cardano/DbSync/Util.hs Show resolved Hide resolved
@sgillespie
Copy link
Contributor

hlint failure: https://ci.iog.io/build/538220/nixlog/4

@Cmdv Cmdv force-pushed the 1459-replace-panic-with-exceptions branch from af782f7 to 920b18f Compare August 9, 2023 09:13
@Cmdv Cmdv requested review from sgillespie and kderme August 9, 2023 09:15
@Cmdv Cmdv force-pushed the 1459-replace-panic-with-exceptions branch from 920b18f to 9680b0b Compare August 9, 2023 11:51
Copy link
Contributor

@sgillespie sgillespie left a comment

Choose a reason for hiding this comment

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

LGTM

@Cmdv Cmdv merged commit 21c8b27 into master Aug 10, 2023
5 of 9 checks passed
@iohk-bors iohk-bors bot deleted the 1459-replace-panic-with-exceptions branch August 10, 2023 08:16
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.

Replace panic by exceptions
3 participants