From 8db8c51f8c16e768a1b73b40397dd2b3318c5fc8 Mon Sep 17 00:00:00 2001 From: Tudor Voicu Date: Wed, 20 Oct 2021 09:13:05 +0200 Subject: [PATCH] Revert improvement to TransactionNotFound cause message since Canton still outputs the old message and assertions fail. --- .../daml/error/definitions/LedgerApiErrors.scala | 2 +- .../server/api/validation/ErrorFactories.scala | 2 +- .../api/validation/ErrorFactoriesSpec.scala | 8 ++++++-- .../testtool/suites/ParticipantPruningIT.scala | 8 ++++---- .../suites/TransactionServiceQueryIT.scala | 16 ++++++++-------- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/ledger/error/src/main/scala/com/daml/error/definitions/LedgerApiErrors.scala b/ledger/error/src/main/scala/com/daml/error/definitions/LedgerApiErrors.scala index 344ef4817e58..694608206ae9 100644 --- a/ledger/error/src/main/scala/com/daml/error/definitions/LedgerApiErrors.scala +++ b/ledger/error/src/main/scala/com/daml/error/definitions/LedgerApiErrors.scala @@ -78,7 +78,7 @@ object LedgerApiErrors extends LedgerApiErrorGroup { ) { case class Reject(transactionId: String)(implicit loggingContext: ContextualizedErrorLogger) - extends LoggingTransactionErrorImpl(cause = "Transaction not found or not visible.") { + extends LoggingTransactionErrorImpl(cause = "Transaction not found, or not visible.") { override def resources: Seq[(ErrorResource, String)] = Seq( (ErrorResource.TransactionId, transactionId) ) diff --git a/ledger/ledger-api-common/src/main/scala/com/digitalasset/platform/server/api/validation/ErrorFactories.scala b/ledger/ledger-api-common/src/main/scala/com/digitalasset/platform/server/api/validation/ErrorFactories.scala index c79f79d24618..0c90b53b98e0 100644 --- a/ledger/ledger-api-common/src/main/scala/com/digitalasset/platform/server/api/validation/ErrorFactories.scala +++ b/ledger/ledger-api-common/src/main/scala/com/digitalasset/platform/server/api/validation/ErrorFactories.scala @@ -29,7 +29,7 @@ class ErrorFactories private (errorCodesVersionSwitcher: ErrorCodesVersionSwitch Status .newBuilder() .setCode(Code.NOT_FOUND.value()) - .setMessage("Transaction not found or not visible.") + .setMessage("Transaction not found, or not visible..") .build() ), v2 = LedgerApiErrors.ReadErrors.TransactionNotFound diff --git a/ledger/ledger-api-common/src/test/suite/scala/com/digitalasset/platform/server/api/validation/ErrorFactoriesSpec.scala b/ledger/ledger-api-common/src/test/suite/scala/com/digitalasset/platform/server/api/validation/ErrorFactoriesSpec.scala index e3affba441e3..345f1da2553d 100644 --- a/ledger/ledger-api-common/src/test/suite/scala/com/digitalasset/platform/server/api/validation/ErrorFactoriesSpec.scala +++ b/ledger/ledger-api-common/src/test/suite/scala/com/digitalasset/platform/server/api/validation/ErrorFactoriesSpec.scala @@ -36,11 +36,11 @@ class ErrorFactoriesSpec extends AnyWordSpec with Matchers with TableDrivenPrope "return a transactionNotFound error" in { assertVersionedError(_.transactionNotFound(Ref.TransactionId.assertFromString("tId")))( v1_code = Code.NOT_FOUND, - v1_message = "Transaction not found or not visible.", + v1_message = "Transaction not found, or not visible..", v1_details = Seq.empty, v2_code = Code.NOT_FOUND, v2_message = - s"TRANSACTION_NOT_FOUND(11,$correlationId): Transaction not found or not visible.", + s"TRANSACTION_NOT_FOUND(11,$correlationId): Transaction not found, or not visible.", v2_details = Seq[ErrorDetails.ErrorDetail]( ErrorDetails.ErrorInfoDetail("TRANSACTION_NOT_FOUND"), DefaultTraceIdRequestInfo, @@ -318,6 +318,10 @@ class ErrorFactoriesSpec extends AnyWordSpec with Matchers with TableDrivenPrope v2_code = Code.INVALID_ARGUMENT, v2_message = s"INVALID_ARGUMENT(8,$correlationId): The submitted command has invalid arguments: my message", + v2_details = Seq[ErrorDetails.ErrorDetail]( + ErrorDetails.ErrorInfoDetail("INVALID_ARGUMENT"), + DefaultTraceIdRequestInfo, + ), ) } } diff --git a/ledger/ledger-api-test-tool/src/main/scala/com/daml/ledger/api/testtool/suites/ParticipantPruningIT.scala b/ledger/ledger-api-test-tool/src/main/scala/com/daml/ledger/api/testtool/suites/ParticipantPruningIT.scala index a40e2af316a2..66323214658a 100644 --- a/ledger/ledger-api-test-tool/src/main/scala/com/daml/ledger/api/testtool/suites/ParticipantPruningIT.scala +++ b/ledger/ledger-api-test-tool/src/main/scala/com/daml/ledger/api/testtool/suites/ParticipantPruningIT.scala @@ -283,7 +283,7 @@ class ParticipantPruningIT extends LedgerTestSuite { ) } yield { prunedTransactionTrees.foreach( - assertGrpcError(_, Status.Code.NOT_FOUND, Some("Transaction not found or not visible.")) + assertGrpcError(_, Status.Code.NOT_FOUND, Some("Transaction not found, or not visible..")) ) } }) @@ -326,7 +326,7 @@ class ParticipantPruningIT extends LedgerTestSuite { ) } yield { prunedFlatTransactions.foreach( - assertGrpcError(_, Status.Code.NOT_FOUND, Some("Transaction not found or not visible.")) + assertGrpcError(_, Status.Code.NOT_FOUND, Some("Transaction not found, or not visible..")) ) } }) @@ -365,7 +365,7 @@ class ParticipantPruningIT extends LedgerTestSuite { _ <- Future.sequence(unprunedEventIds.map(participant.transactionTreeByEventId(_, submitter))) } yield { prunedEventsViaTree.foreach( - assertGrpcError(_, Status.Code.NOT_FOUND, Some("Transaction not found or not visible.")) + assertGrpcError(_, Status.Code.NOT_FOUND, Some("Transaction not found, or not visible..")) ) } }) @@ -404,7 +404,7 @@ class ParticipantPruningIT extends LedgerTestSuite { _ <- Future.sequence(unprunedEventIds.map(participant.flatTransactionByEventId(_, submitter))) } yield { prunedEventsViaFlat.foreach( - assertGrpcError(_, Status.Code.NOT_FOUND, Some("Transaction not found or not visible.")) + assertGrpcError(_, Status.Code.NOT_FOUND, Some("Transaction not found, or not visible..")) ) } }) diff --git a/ledger/ledger-api-test-tool/src/main/scala/com/daml/ledger/api/testtool/suites/TransactionServiceQueryIT.scala b/ledger/ledger-api-test-tool/src/main/scala/com/daml/ledger/api/testtool/suites/TransactionServiceQueryIT.scala index 91382d71f092..9b6a9f808e85 100644 --- a/ledger/ledger-api-test-tool/src/main/scala/com/daml/ledger/api/testtool/suites/TransactionServiceQueryIT.scala +++ b/ledger/ledger-api-test-tool/src/main/scala/com/daml/ledger/api/testtool/suites/TransactionServiceQueryIT.scala @@ -42,7 +42,7 @@ class TransactionServiceQueryIT extends LedgerTestSuite { assertGrpcError( failure, Status.Code.NOT_FOUND, - Some("Transaction not found or not visible."), + Some("Transaction not found, or not visible.."), ) } }) @@ -60,7 +60,7 @@ class TransactionServiceQueryIT extends LedgerTestSuite { assertGrpcError( failure, Status.Code.NOT_FOUND, - Some("Transaction not found or not visible."), + Some("Transaction not found, or not visible.."), ) } }) @@ -94,7 +94,7 @@ class TransactionServiceQueryIT extends LedgerTestSuite { assertGrpcError( failure, Status.Code.NOT_FOUND, - Some("Transaction not found or not visible."), + Some("Transaction not found, or not visible.."), ) } }) @@ -112,7 +112,7 @@ class TransactionServiceQueryIT extends LedgerTestSuite { assertGrpcError( failure, Status.Code.NOT_FOUND, - Some("Transaction not found or not visible."), + Some("Transaction not found, or not visible.."), ) } }) @@ -148,7 +148,7 @@ class TransactionServiceQueryIT extends LedgerTestSuite { assertGrpcError( failure, Status.Code.NOT_FOUND, - Some("Transaction not found or not visible."), + Some("Transaction not found, or not visible.."), ) } }) @@ -166,7 +166,7 @@ class TransactionServiceQueryIT extends LedgerTestSuite { assertGrpcError( failure, Status.Code.NOT_FOUND, - Some("Transaction not found or not visible."), + Some("Transaction not found, or not visible.."), ) } }) @@ -202,7 +202,7 @@ class TransactionServiceQueryIT extends LedgerTestSuite { assertGrpcError( failure, Status.Code.NOT_FOUND, - Some("Transaction not found or not visible."), + Some("Transaction not found, or not visible.."), ) } }) @@ -220,7 +220,7 @@ class TransactionServiceQueryIT extends LedgerTestSuite { assertGrpcError( failure, Status.Code.NOT_FOUND, - Some("Transaction not found or not visible."), + Some("Transaction not found, or not visible.."), ) } })