Open
Description
[ This issue was auto-migrated from DA's internal repo (DACH-NY/canton-network-node#751). Original author: @rautenrieth-da ]
Replace all occurences of catching a ledger API error and matching the error message by string by properly using self-service error codes.
See also:
- https://github.com/digital-asset/daml/blob/main/ledger/error/src/main/scala/com/daml/error/ErrorCategory.scala
- https://github.com/digital-asset/daml/blob/main/ledger/error/src/main/scala/com/daml/error/utils/ErrorDetails.scala
- https://github.com/digital-asset/daml/blob/main/ledger/error/src/main/scala/com/daml/error/definitions/ErrorGroups.scala
- https://github.com/digital-asset/daml/blob/main/ledger/error/src/main/scala/com/daml/error/definitions/LedgerApiErrors.scala
- https://github.com/DACH-NY/canton/blob/main/community/common/src/main/scala/com/digitalasset/canton/error/CantonErrorGroups.scala
Moreover, follow Canton's guideline that if you assert on logs in tests:
_.warningMessage should include("Lost subscription to domain"),
Then please use the error code directly:
Seq(_.shouldBeCantonErrorCode(LostSequencerSubscription)),
Reasons:
- We can change the text in one go without having to change text in multiple places
- We can use IntelliJ to figure out which error code is referenced in which test.
- logger.error / logger.warn should not be used in canton. Everything on that logger level should be an error code (which in turn logs error or warning).