diff --git a/docs/source/app-dev/grpc/error-codes.rst b/docs/source/app-dev/grpc/error-codes.rst index f9ab7d0735d3..d3a828251867 100644 --- a/docs/source/app-dev/grpc/error-codes.rst +++ b/docs/source/app-dev/grpc/error-codes.rst @@ -374,150 +374,9 @@ Common Ledger API changes The table below outlines generic gRPC status code changes pertaining to the Ledger API and apply to all ledger backends. For changes specific to a ledger backend, check the next subsections. -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|Service endpoint |gRPC status code |gRPC status code |Remarks |Ledger API error code ID | -| |(before SDK 1.18) |(since SDK 1.18) | | | -+===============================================+===================================+==================================+=========================================================================================================================+==================================================================================+ -|ActiveContractsService.getActiveContracts |NOT_FOUND |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when attempting to access the data that has already been pruned. |PARTICIPANT_PRUNED_DATA_ACCESSED | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|ActiveContractsService.getActiveContracts |NOT_FOUND |NOT_FOUND |The ledger id from the request does match the participant's ledger id. |LEDGER_ID_MISMATCH | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandCompletionService.completionStream |NOT_FOUND |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when attempting to access the data that has already been pruned. |PARTICIPANT_PRUNED_DATA_ACCESSED | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandCompletionService.completionStream |NOT_FOUND |NOT_FOUND |The ledger id from the request does match the participant's ledger id. |LEDGER_ID_MISMATCH | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWait |ABORTED |DEADLINE_EXCEEDED |DEADLINE_EXCEEDED is now returned on Command Service submissions timeouts. |REQUEST_TIME_OUT | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWait |ABORTED |INTERNAL |INTERNAL is not returned on Command Service submissions on unexpected errors. |LEDGER_API_INTERNAL_ERROR | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWait |ABORTED |UNAVAILABLE |UNAVAILABLE is now returned on Command Service submissions on backpressure. |SERVICE_NOT_RUNNING | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWait |RESOURCE_EXHAUSTED |ABORTED |ABORTED is now returned on Command Service submissions on backpressure. |PARTICIPANT_BACKPRESSURE | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWait |UNAVAILABLE |NOT_FOUND |NOT_FOUND can now be returned when a ledger configuration was not found. |LEDGER_CONFIGURATION_NOT_FOUND | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWait |UNAVAILABLE |UNAVAILABLE |A service is not running. |SERVICE_NOT_RUNNING | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransaction |ABORTED |DEADLINE_EXCEEDED |DEADLINE_EXCEEDED is now returned on Command Service submissions timeouts. |REQUEST_TIME_OUT | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransaction |ABORTED |INTERNAL |INTERNAL is not returned on Command Service submissions on unexpected errors. |LEDGER_API_INTERNAL_ERROR | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransaction |ABORTED |UNAVAILABLE |UNAVAILABLE is now returned on Command Service submissions on backpressure. |SERVICE_NOT_RUNNING | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransaction |RESOURCE_EXHAUSTED |ABORTED |ABORTED is now returned on Command Service submissions on backpressure. |PARTICIPANT_BACKPRESSURE | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransaction |UNAVAILABLE |NOT_FOUND |NOT_FOUND can now be returned when a ledger configuration was not found. |LEDGER_CONFIGURATION_NOT_FOUND | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransaction |UNAVAILABLE |UNAVAILABLE |A service is not running. |SERVICE_NOT_RUNNING | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransactionId |ABORTED |DEADLINE_EXCEEDED |DEADLINE_EXCEEDED is now returned on Command Service submissions timeouts. |REQUEST_TIME_OUT | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransactionId |ABORTED |INTERNAL |INTERNAL is not returned on Command Service submissions on unexpected errors. |LEDGER_API_INTERNAL_ERROR | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransactionId |ABORTED |UNAVAILABLE |UNAVAILABLE is now returned on Command Service submissions on backpressure. |SERVICE_NOT_RUNNING | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransactionId |RESOURCE_EXHAUSTED |ABORTED |ABORTED is now returned on Command Service submissions on backpressure. |PARTICIPANT_BACKPRESSURE | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransactionId |UNAVAILABLE |NOT_FOUND |NOT_FOUND can now be returned when a ledger configuration was not found. |LEDGER_CONFIGURATION_NOT_FOUND | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransactionId |UNAVAILABLE |UNAVAILABLE |A service is not running. |SERVICE_NOT_RUNNING | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransactionTree |ABORTED |DEADLINE_EXCEEDED |DEADLINE_EXCEEDED is now returned on Command Service submissions timeouts. |REQUEST_TIME_OUT | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransactionTree |ABORTED |INTERNAL |INTERNAL is not returned on Command Service submissions on unexpected errors. |LEDGER_API_INTERNAL_ERROR | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransactionTree |ABORTED |UNAVAILABLE |UNAVAILABLE is now returned on Command Service submissions on backpressure. |SERVICE_NOT_RUNNING | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransactionTree |RESOURCE_EXHAUSTED |ABORTED |ABORTED is now returned on Command Service submissions on backpressure. |PARTICIPANT_BACKPRESSURE | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransactionTree |UNAVAILABLE |NOT_FOUND |NOT_FOUND can now be returned when a ledger configuration was not found. |LEDGER_CONFIGURATION_NOT_FOUND | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandService.submitAndWaitForTransactionTree |UNAVAILABLE |UNAVAILABLE |A service is not running. |SERVICE_NOT_RUNNING | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|CommandSubmissionService.submit |UNAVAILABLE |NOT_FOUND |NOT_FOUND can now be returned when a ledger configuration was not found. |LEDGER_CONFIGURATION_NOT_FOUND | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|ConfigManagementService.setTimeModel |ABORTED |DEADLINE_EXCEEDED |DEADLINE_EXCEEDED can now be returned when a time out was reached. |REQUEST_TIME_OUT | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|ConfigManagementService.setTimeModel |ABORTED |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when a configuration update was rejected. |CONFIGURATION_ENTRY_REJECTED | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|ConfigManagementService.setTimeModel |UNAVAILABLE |NOT_FOUND |NOT_FOUND can now be returned when a ledger configuration was not found. |LEDGER_CONFIGURATION_NOT_FOUND | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|GrpcHealthService.check |NOT_FOUND |INVALID_ARGUMENT |INVALID_ARGUMENT can now be returned when the received request contains invalid values. |INVALID_ARGUMENT | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|GrpcHealthService.watch |NOT_FOUND |INVALID_ARGUMENT |INVALID_ARGUMENT can now be returned when the received request contains invalid values. |INVALID_ARGUMENT | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|PackageManagementService.uploadDarFile |ABORTED |DEADLINE_EXCEEDED |DEADLINE_EXCEEDED can now be returned when a time out was reached. |REQUEST_TIME_OUT | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|PackageManagementService.uploadDarFile |INVALID_ARGUMENT |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when a package upload was rejected. |PACKAGE_UPLOAD_REJECTED | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|PackageManagementService.uploadDarFile |INVALID_ARGUMENT |INVALID_ARGUMENT |Generic error for invalid arguments in the request. |INVALID_ARGUMENT | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|ParticipantPruningService.prune |INVALID_ARGUMENT |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when the supplied pruning offset is not before the ledger end. |OFFSET_OUT_OF_RANGE | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|ParticipantPruningService.prune |INVALID_ARGUMENT |INVALID_ARGUMENT |Generic error for invalid arguments in the request. |INVALID_ARGUMENT | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|ParticipantPruningService.prune |INVALID_ARGUMENT |INVALID_ARGUMENT |The offset is not in hexadecimal format. |NON_HEXADECIMAL_OFFSET | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|PartyManagementService.allocateParty |ABORTED |DEADLINE_EXCEEDED |DEADLINE_EXCEEDED can now be returned when a time out was reached. |REQUEST_TIME_OUT | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|SubmissionService.submit |ABORTED |ABORTED |Failed to determine ledger time. |FAILED_TO_DETERMINE_LEDGER_TIME | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|SubmissionService.submit |ABORTED |ALREADY_EXISTS |ALREADY_EXISTS can now be returned when there was a duplicate contract key during interpretation. |DUPLICATE_CONTRACT_KEY_DURING_INTERPRETATION | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|SubmissionService.submit |ABORTED |INTERNAL |INTERNAL can now be returned when validation fails on a mismatch during relay of the submitted transaction. |LEDGER_API_INTERNAL_ERROR | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|SubmissionService.submit |ABORTED |NOT_FOUND |NOT_FOUND can now be returned when contract key was not found during interpretation. |CONTRACT_NOT_FOUND | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|SubmissionService.submit |INVALID_ARGUMENT |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when a Daml transaction fails during interpretation. |DAML_INTERPRETATION_ERROR | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|SubmissionService.submit |INVALID_ARGUMENT |INTERNAL |INTERNAL can now be returned in case of internal errors. |LEDGER_API_INTERNAL_ERROR | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|SubmissionService.submit |INVALID_ARGUMENT |INVALID_ARGUMENT |Invalid argument detected before command execution. |ALLOWED_LANGUAGE_VERSIONS, COMMAND_PREPROCESSING_FAILED, DAML_AUTHORIZATION_ERROR | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|SubmissionService.submit |INVALID_ARGUMENT |INVALID_ARGUMENT |Invalid argument detected by the Daml interpreter. |DAML_INTERPRETER_INVALID_ARGUMENT | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|SubmissionService.submit |INVALID_ARGUMENT |NOT_FOUND |NOT_FOUND can now be returned when a Daml interpreter can not resolve a contract key to an active contract. |CONTRACT_KEY_NOT_FOUND | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|SubmissionService.submit |INVALID_ARGUMENT |NOT_FOUND |NOT_FOUND can now be returned when a Daml transaction was referring to a package which was not known to the participant. |MISSING_PACKAGE | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|SubmissionService.submit |INVALID_ARGUMENT |NOT_FOUND |NOT_FOUND can now be returned when an exercise or fetch happens on a transaction-locally consumed contract. |CONTRACT_NOT_ACTIVE | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|SubmissionService.submit |INVALID_ARGUMENT |UNKNOWN |UNKNOWN can now be returned when package validation fails. |PACKAGE_VALIDATION_FAILED | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|SubmissionService.submit |UNAVAILABLE |NOT_FOUND |NOT_FOUND can now be returned when a ledger configuration was not found. |LEDGER_CONFIGURATION_NOT_FOUND | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|TransactionService.getFlatTransactionByEventId |NOT_FOUND |INVALID_ARGUMENT |INVALID_ARGUMENT can now be returned when the received request contains invalid values. |INVALID_ARGUMENT | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|TransactionService.getFlatTransactionByEventId |NOT_FOUND |NOT_FOUND |The ledger id from the request does match the participant's ledger id. |LEDGER_ID_MISMATCH | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|TransactionService.getTransactionByEventId |NOT_FOUND |INVALID_ARGUMENT |INVALID_ARGUMENT can now be returned when the received request contains invalid values. |INVALID_ARGUMENT | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|TransactionService.getTransactionByEventId |NOT_FOUND |NOT_FOUND |The ledger id from the request does match the participant's ledger id. |LEDGER_ID_MISMATCH | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|TransactionService.getTransactionByEventId |NOT_FOUND |NOT_FOUND |Transaction was not found. |TRANSACTION_NOT_FOUND | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|TransactionService.getTransactionTrees |INVALID_ARGUMENT |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when the supplied offset was out of range. |OFFSET_OUT_OF_RANGE | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|TransactionService.getTransactionTrees |INVALID_ARGUMENT |INVALID_ARGUMENT |A field is missing in the request. |MISSING_FIELD | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|TransactionService.getTransactionTrees |INVALID_ARGUMENT |INVALID_ARGUMENT |Generic error for invalid arguments in the request. |INVALID_ARGUMENT | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|TransactionService.getTransactionTrees |INVALID_ARGUMENT |INVALID_ARGUMENT |Invalid field detected in the request. |INVALID_FIELD | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|TransactionService.getTransactionTrees |NOT_FOUND |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when attempting to access the data that has already been pruned. |PARTICIPANT_PRUNED_DATA_ACCESSED | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|TransactionService.getTransactions |INVALID_ARGUMENT |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when the supplied offset was out of range. |OFFSET_OUT_OF_RANGE | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|TransactionService.getTransactions |INVALID_ARGUMENT |INVALID_ARGUMENT |A field is missing in the request. |MISSING_FIELD | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|TransactionService.getTransactions |INVALID_ARGUMENT |INVALID_ARGUMENT |Generic error for invalid arguments in the request. |INVALID_ARGUMENT | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|TransactionService.getTransactions |INVALID_ARGUMENT |INVALID_ARGUMENT |Invalid field detected in the request. |INVALID_FIELD | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|TransactionService.getTransactions |NOT_FOUND |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when attempting to access the data that has already been pruned. |PARTICIPANT_PRUNED_DATA_ACCESSED | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -|TransactionService.getTransactions |NOT_FOUND |NOT_FOUND |The ledger id from the request does match the participant's ledger id. |LEDGER_ID_MISMATCH | -+-----------------------------------------------+-----------------------------------+----------------------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +(Note that status codes that have not changed for particular endpoints are not listed in the tables below.) + +.. include:: status-codes-migration-table-ledger-api.rst Sandbox (classic) --------------------------- diff --git a/docs/source/app-dev/grpc/status-codes-migration-table-ledger-api.rst b/docs/source/app-dev/grpc/status-codes-migration-table-ledger-api.rst new file mode 100644 index 000000000000..a19b2deb1c79 --- /dev/null +++ b/docs/source/app-dev/grpc/status-codes-migration-table-ledger-api.rst @@ -0,0 +1,304 @@ +.. Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +ActiveContractsService.getActiveContracts +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++==================+====================+=========================================================================================================+=================================+ +|NOT_FOUND |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when attempting to access the data that has already been pruned. |PARTICIPANT_PRUNED_DATA_ACCESSED | ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ +|NOT_FOUND |NOT_FOUND |The ledger id from the request does match the participant's ledger id. |LEDGER_ID_MISMATCH | ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ + + +CommandCompletionService.completionStream +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++==================+====================+=========================================================================================================+=================================+ +|NOT_FOUND |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when attempting to access the data that has already been pruned. |PARTICIPANT_PRUNED_DATA_ACCESSED | ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ +|NOT_FOUND |NOT_FOUND |The ledger id from the request does match the participant's ledger id. |LEDGER_ID_MISMATCH | ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ + + +CommandService.submitAndWait +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++===================+==================+==============================================================================+===============================+ +|ABORTED |DEADLINE_EXCEEDED |DEADLINE_EXCEEDED is now returned on Command Service submissions timeouts. |REQUEST_TIME_OUT | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|ABORTED |INTERNAL |INTERNAL is not returned on Command Service submissions on unexpected errors. |LEDGER_API_INTERNAL_ERROR | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|ABORTED |UNAVAILABLE |UNAVAILABLE is now returned on Command Service submissions on backpressure. |SERVICE_NOT_RUNNING | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|RESOURCE_EXHAUSTED |ABORTED |ABORTED is now returned on Command Service submissions on backpressure. |PARTICIPANT_BACKPRESSURE | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|UNAVAILABLE |NOT_FOUND |NOT_FOUND can now be returned when a ledger configuration was not found. |LEDGER_CONFIGURATION_NOT_FOUND | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|UNAVAILABLE |UNAVAILABLE |A service is not running. |SERVICE_NOT_RUNNING | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ + + +CommandService.submitAndWaitForTransaction +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++===================+==================+==============================================================================+===============================+ +|ABORTED |DEADLINE_EXCEEDED |DEADLINE_EXCEEDED is now returned on Command Service submissions timeouts. |REQUEST_TIME_OUT | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|ABORTED |INTERNAL |INTERNAL is not returned on Command Service submissions on unexpected errors. |LEDGER_API_INTERNAL_ERROR | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|ABORTED |UNAVAILABLE |UNAVAILABLE is now returned on Command Service submissions on backpressure. |SERVICE_NOT_RUNNING | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|RESOURCE_EXHAUSTED |ABORTED |ABORTED is now returned on Command Service submissions on backpressure. |PARTICIPANT_BACKPRESSURE | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|UNAVAILABLE |NOT_FOUND |NOT_FOUND can now be returned when a ledger configuration was not found. |LEDGER_CONFIGURATION_NOT_FOUND | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|UNAVAILABLE |UNAVAILABLE |A service is not running. |SERVICE_NOT_RUNNING | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ + + +CommandService.submitAndWaitForTransactionId +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++===================+==================+==============================================================================+===============================+ +|ABORTED |DEADLINE_EXCEEDED |DEADLINE_EXCEEDED is now returned on Command Service submissions timeouts. |REQUEST_TIME_OUT | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|ABORTED |INTERNAL |INTERNAL is not returned on Command Service submissions on unexpected errors. |LEDGER_API_INTERNAL_ERROR | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|ABORTED |UNAVAILABLE |UNAVAILABLE is now returned on Command Service submissions on backpressure. |SERVICE_NOT_RUNNING | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|RESOURCE_EXHAUSTED |ABORTED |ABORTED is now returned on Command Service submissions on backpressure. |PARTICIPANT_BACKPRESSURE | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|UNAVAILABLE |NOT_FOUND |NOT_FOUND can now be returned when a ledger configuration was not found. |LEDGER_CONFIGURATION_NOT_FOUND | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|UNAVAILABLE |UNAVAILABLE |A service is not running. |SERVICE_NOT_RUNNING | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ + + +CommandService.submitAndWaitForTransactionTree +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++===================+==================+==============================================================================+===============================+ +|ABORTED |DEADLINE_EXCEEDED |DEADLINE_EXCEEDED is now returned on Command Service submissions timeouts. |REQUEST_TIME_OUT | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|ABORTED |INTERNAL |INTERNAL is not returned on Command Service submissions on unexpected errors. |LEDGER_API_INTERNAL_ERROR | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|ABORTED |UNAVAILABLE |UNAVAILABLE is now returned on Command Service submissions on backpressure. |SERVICE_NOT_RUNNING | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|RESOURCE_EXHAUSTED |ABORTED |ABORTED is now returned on Command Service submissions on backpressure. |PARTICIPANT_BACKPRESSURE | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|UNAVAILABLE |NOT_FOUND |NOT_FOUND can now be returned when a ledger configuration was not found. |LEDGER_CONFIGURATION_NOT_FOUND | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ +|UNAVAILABLE |UNAVAILABLE |A service is not running. |SERVICE_NOT_RUNNING | ++-------------------+------------------+------------------------------------------------------------------------------+-------------------------------+ + + +CommandSubmissionService.submit +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------------+-----------------+-------------------------------------------------------------------------+-------------------------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++==================+=================+=========================================================================+===============================+ +|UNAVAILABLE |NOT_FOUND |NOT_FOUND can now be returned when a ledger configuration was not found. |LEDGER_CONFIGURATION_NOT_FOUND | ++------------------+-----------------+-------------------------------------------------------------------------+-------------------------------+ + + +ConfigManagementService.setTimeModel +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------------+--------------------+----------------------------------------------------------------------------------+-------------------------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++==================+====================+==================================================================================+===============================+ +|ABORTED |DEADLINE_EXCEEDED |DEADLINE_EXCEEDED can now be returned when a time out was reached. |REQUEST_TIME_OUT | ++------------------+--------------------+----------------------------------------------------------------------------------+-------------------------------+ +|ABORTED |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when a configuration update was rejected. |CONFIGURATION_ENTRY_REJECTED | ++------------------+--------------------+----------------------------------------------------------------------------------+-------------------------------+ +|UNAVAILABLE |NOT_FOUND |NOT_FOUND can now be returned when a ledger configuration was not found. |LEDGER_CONFIGURATION_NOT_FOUND | ++------------------+--------------------+----------------------------------------------------------------------------------+-------------------------------+ + + +GrpcHealthService.check +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------------+-----------------+----------------------------------------------------------------------------------------+-----------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++==================+=================+========================================================================================+=================+ +|NOT_FOUND |INVALID_ARGUMENT |INVALID_ARGUMENT can now be returned when the received request contains invalid values. |INVALID_ARGUMENT | ++------------------+-----------------+----------------------------------------------------------------------------------------+-----------------+ + + +GrpcHealthService.watch +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------------+-----------------+----------------------------------------------------------------------------------------+-----------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++==================+=================+========================================================================================+=================+ +|NOT_FOUND |INVALID_ARGUMENT |INVALID_ARGUMENT can now be returned when the received request contains invalid values. |INVALID_ARGUMENT | ++------------------+-----------------+----------------------------------------------------------------------------------------+-----------------+ + + +PackageManagementService.uploadDarFile +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------------+--------------------+----------------------------------------------------------------------------+------------------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++==================+====================+============================================================================+========================+ +|ABORTED |DEADLINE_EXCEEDED |DEADLINE_EXCEEDED can now be returned when a time out was reached. |REQUEST_TIME_OUT | ++------------------+--------------------+----------------------------------------------------------------------------+------------------------+ +|INVALID_ARGUMENT |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when a package upload was rejected. |PACKAGE_UPLOAD_REJECTED | ++------------------+--------------------+----------------------------------------------------------------------------+------------------------+ +|INVALID_ARGUMENT |INVALID_ARGUMENT |Generic error for invalid arguments in the request. |INVALID_ARGUMENT | ++------------------+--------------------+----------------------------------------------------------------------------+------------------------+ + + +ParticipantPruningService.prune +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------------+--------------------+-------------------------------------------------------------------------------------------------------+-----------------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++==================+====================+=======================================================================================================+=======================+ +|INVALID_ARGUMENT |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when the supplied pruning offset is not before the ledger end. |OFFSET_OUT_OF_RANGE | ++------------------+--------------------+-------------------------------------------------------------------------------------------------------+-----------------------+ +|INVALID_ARGUMENT |INVALID_ARGUMENT |Generic error for invalid arguments in the request. |INVALID_ARGUMENT | ++------------------+--------------------+-------------------------------------------------------------------------------------------------------+-----------------------+ +|INVALID_ARGUMENT |INVALID_ARGUMENT |The offset is not in hexadecimal format. |NON_HEXADECIMAL_OFFSET | ++------------------+--------------------+-------------------------------------------------------------------------------------------------------+-----------------------+ + + +PartyManagementService.allocateParty +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------------+------------------+-------------------------------------------------------------------+-----------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++==================+==================+===================================================================+=================+ +|ABORTED |DEADLINE_EXCEEDED |DEADLINE_EXCEEDED can now be returned when a time out was reached. |REQUEST_TIME_OUT | ++------------------+------------------+-------------------------------------------------------------------+-----------------+ + + +SubmissionService.submit +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------------+--------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++==================+====================+=========================================================================================================================+==================================================================================+ +|ABORTED |ABORTED |Failed to determine ledger time. |FAILED_TO_DETERMINE_LEDGER_TIME | ++------------------+--------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +|ABORTED |ALREADY_EXISTS |ALREADY_EXISTS can now be returned when there was a duplicate contract key during interpretation. |DUPLICATE_CONTRACT_KEY_DURING_INTERPRETATION | ++------------------+--------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +|ABORTED |INTERNAL |INTERNAL can now be returned when validation fails on a mismatch during relay of the submitted transaction. |LEDGER_API_INTERNAL_ERROR | ++------------------+--------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +|ABORTED |NOT_FOUND |NOT_FOUND can now be returned when contract key was not found during interpretation. |CONTRACT_NOT_FOUND | ++------------------+--------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +|INVALID_ARGUMENT |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when a Daml transaction fails during interpretation. |DAML_INTERPRETATION_ERROR | ++------------------+--------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +|INVALID_ARGUMENT |INTERNAL |INTERNAL can now be returned in case of internal errors. |LEDGER_API_INTERNAL_ERROR | ++------------------+--------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +|INVALID_ARGUMENT |INVALID_ARGUMENT |Invalid argument detected before command execution. |ALLOWED_LANGUAGE_VERSIONS, COMMAND_PREPROCESSING_FAILED, DAML_AUTHORIZATION_ERROR | ++------------------+--------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +|INVALID_ARGUMENT |INVALID_ARGUMENT |Invalid argument detected by the Daml interpreter. |DAML_INTERPRETER_INVALID_ARGUMENT | ++------------------+--------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +|INVALID_ARGUMENT |NOT_FOUND |NOT_FOUND can now be returned when a Daml interpreter can not resolve a contract key to an active contract. |CONTRACT_KEY_NOT_FOUND | ++------------------+--------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +|INVALID_ARGUMENT |NOT_FOUND |NOT_FOUND can now be returned when a Daml transaction was referring to a package which was not known to the participant. |MISSING_PACKAGE | ++------------------+--------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +|INVALID_ARGUMENT |NOT_FOUND |NOT_FOUND can now be returned when an exercise or fetch happens on a transaction-locally consumed contract. |CONTRACT_NOT_ACTIVE | ++------------------+--------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +|INVALID_ARGUMENT |UNKNOWN |UNKNOWN can now be returned when package validation fails. |PACKAGE_VALIDATION_FAILED | ++------------------+--------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +|UNAVAILABLE |NOT_FOUND |NOT_FOUND can now be returned when a ledger configuration was not found. |LEDGER_CONFIGURATION_NOT_FOUND | ++------------------+--------------------+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ + + +TransactionService.getFlatTransactionByEventId +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------------+-----------------+----------------------------------------------------------------------------------------+-------------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++==================+=================+========================================================================================+===================+ +|NOT_FOUND |INVALID_ARGUMENT |INVALID_ARGUMENT can now be returned when the received request contains invalid values. |INVALID_ARGUMENT | ++------------------+-----------------+----------------------------------------------------------------------------------------+-------------------+ +|NOT_FOUND |NOT_FOUND |The ledger id from the request does match the participant's ledger id. |LEDGER_ID_MISMATCH | ++------------------+-----------------+----------------------------------------------------------------------------------------+-------------------+ + + +TransactionService.getTransactionByEventId +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------------+-----------------+----------------------------------------------------------------------------------------+----------------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++==================+=================+========================================================================================+======================+ +|NOT_FOUND |INVALID_ARGUMENT |INVALID_ARGUMENT can now be returned when the received request contains invalid values. |INVALID_ARGUMENT | ++------------------+-----------------+----------------------------------------------------------------------------------------+----------------------+ +|NOT_FOUND |NOT_FOUND |The ledger id from the request does match the participant's ledger id. |LEDGER_ID_MISMATCH | ++------------------+-----------------+----------------------------------------------------------------------------------------+----------------------+ +|NOT_FOUND |NOT_FOUND |Transaction was not found. |TRANSACTION_NOT_FOUND | ++------------------+-----------------+----------------------------------------------------------------------------------------+----------------------+ + + +TransactionService.getTransactionTrees +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++==================+====================+=========================================================================================================+=================================+ +|INVALID_ARGUMENT |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when the supplied offset was out of range. |OFFSET_OUT_OF_RANGE | ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ +|INVALID_ARGUMENT |INVALID_ARGUMENT |A field is missing in the request. |MISSING_FIELD | ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ +|INVALID_ARGUMENT |INVALID_ARGUMENT |Generic error for invalid arguments in the request. |INVALID_ARGUMENT | ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ +|INVALID_ARGUMENT |INVALID_ARGUMENT |Invalid field detected in the request. |INVALID_FIELD | ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ +|NOT_FOUND |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when attempting to access the data that has already been pruned. |PARTICIPANT_PRUNED_DATA_ACCESSED | ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ + + +TransactionService.getTransactions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ +|gRPC status code |gRPC status code |Remarks |Ledger API | +|(before SDK 1.18) |(since SDK 1.18) | |error code id | ++==================+====================+=========================================================================================================+=================================+ +|INVALID_ARGUMENT |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when the supplied offset was out of range. |OFFSET_OUT_OF_RANGE | ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ +|INVALID_ARGUMENT |INVALID_ARGUMENT |A field is missing in the request. |MISSING_FIELD | ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ +|INVALID_ARGUMENT |INVALID_ARGUMENT |Generic error for invalid arguments in the request. |INVALID_ARGUMENT | ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ +|INVALID_ARGUMENT |INVALID_ARGUMENT |Invalid field detected in the request. |INVALID_FIELD | ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ +|NOT_FOUND |FAILED_PRECONDITION |FAILED_PRECONDITION can now be returned when attempting to access the data that has already been pruned. |PARTICIPANT_PRUNED_DATA_ACCESSED | ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ +|NOT_FOUND |NOT_FOUND |The ledger id from the request does match the participant's ledger id. |LEDGER_ID_MISMATCH | ++------------------+--------------------+---------------------------------------------------------------------------------------------------------+---------------------------------+ + diff --git a/ledger/participant-integration-api/src/docs/scala/com/daml/platform/docs/SelfServiceErrorCodes_MigrationGuideGen_App.scala b/ledger/participant-integration-api/src/docs/scala/com/daml/platform/docs/SelfServiceErrorCodes_MigrationGuideGen_App.scala index fa617bc9541e..6eb6ddc015a1 100644 --- a/ledger/participant-integration-api/src/docs/scala/com/daml/platform/docs/SelfServiceErrorCodes_MigrationGuideGen_App.scala +++ b/ledger/participant-integration-api/src/docs/scala/com/daml/platform/docs/SelfServiceErrorCodes_MigrationGuideGen_App.scala @@ -3,14 +3,14 @@ package com.daml.platform +import java.nio.charset.StandardCharsets + +import com.daml.error.{Description, ErrorCategory, Resolution, RetryStrategy} import io.circe.{Json, JsonObject, ParsingFailure, yaml} import org.apache.commons.io.IOUtils import scala.collection.mutable import scala.collection.mutable.ArrayBuffer -import java.nio.charset.StandardCharsets - -import com.daml.error.{Description, ErrorCategory, Resolution, RetryStrategy} // TODO error codes: Delete it once final version of migration guide is ready. /** How to update self-service error codes migration guide table: @@ -21,131 +21,33 @@ import com.daml.error.{Description, ErrorCategory, Resolution, RetryStrategy} object SelfServiceErrorCodes_MigrationGuideGen_App { def main(args: Array[String]): Unit = { - // Generate error categories table - - case class ErrorCategoryDoc( - description: Option[String], - resolution: Option[String], - retryStrategy: Option[String], + println("\n\n########################## LEDGER API") + println( + genStatusCodeMigrationTableText( + "com/daml/platform/docs/self-service-error-codes-migration.yml" + ) ) - def handleErrorCategoryAnnotations(errorCategory: ErrorCategory): ErrorCategoryDoc = { - import scala.reflect.runtime.{universe => ru} - - val descriptionTypeName = classOf[Description].getTypeName.replace("$", ".") - val resolutionTypeName = classOf[Resolution].getTypeName.replace("$", ".") - val retryStrategyTypeName = classOf[RetryStrategy].getTypeName.replace("$", ".") - - val runtimeMirror: ru.Mirror = ru.runtimeMirror(this.getClass.getClassLoader) - - def isAnnotation(annotation: ru.Annotation, typeName: String): Boolean = - annotationTypeName(annotation) == typeName - - def annotationTypeName(annotation: ru.Annotation) = - annotation.tree.tpe.toString - - @SuppressWarnings(Array("org.wartremover.warts.AsInstanceOf")) - def parseAnnotationValue(tree: ru.Tree): String = { - try { - Seq(1).map( - tree.children(_).asInstanceOf[ru.Literal].value.value.asInstanceOf[String] - ) match { - case s :: Nil => s.stripMargin - case _ => sys.exit(1) - } - } catch { - case x: RuntimeException => - println( - "Failed to process description (description needs to be a constant-string. i.e. don't apply stripmargin here ...): " + tree.toString - ) - throw x - } - } - - val mirroredType = runtimeMirror.reflect(errorCategory) - val annotations: Seq[ru.Annotation] = mirroredType.symbol.annotations - - var description: Option[String] = None - var resolution: Option[String] = None - var retryStrategy: Option[String] = None - annotations.foreach { annotation => - if (isAnnotation(annotation, descriptionTypeName)) { - description = Option(parseAnnotationValue(annotation.tree)) - } else if (isAnnotation(annotation, resolutionTypeName)) { - resolution = Option(parseAnnotationValue(annotation.tree)) - } else if (isAnnotation(annotation, retryStrategyTypeName)) { - retryStrategy = Option(parseAnnotationValue(annotation.tree)) - } else { - ??? - } - } - - ErrorCategoryDoc( - description = description, - resolution = resolution, - retryStrategy = retryStrategy, + println("\n\n########################## SANDBOX classic") + println( + genStatusCodeMigrationTableText( + "com/daml/platform/docs/self-service-error-codes-sandbox-classic-migration.yml" ) + ) - } - - val errorCategoriesTable: Array[Array[String]] = ErrorCategory.all.map { cat: ErrorCategory => - val doc = handleErrorCategoryAnnotations(cat) - println(doc) - val intValue: String = cat.asInt.toString - val grpcCode: String = cat.grpcCode.fold("N/A")(_.toString) - val name: String = cat.getClass.getSimpleName.replace("$", "") - val logLevel: String = cat.logLevel.toString - - Array( - name, - intValue, - grpcCode, - doc.description.getOrElse("").replace("\n", " "), - doc.resolution.getOrElse("").replace("\n", " "), - doc.retryStrategy.getOrElse("").replace("\n", " "), - logLevel, + println("\n\n########################## KV (Daml Sandbox and VMBC)") + println( + genStatusCodeMigrationTableText( + "com/daml/platform/docs/self-service-error-codes-kv-errors-migration.yml" ) - - }.toArray - - val errorCategoryTableText = generateReStTable( - errorCategoriesTable, - header = Array( - "Error category", - "Category id", - "gRPC code", - "Description", - "Resolution", - "Retry strategy", - "Log level", - ), ) - def genSubsectionsForErrorCategory(a: Array[String]) = { - s"""${a(0)} - |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | **Category id**: ${a(1)} - | - | **gRPC status code**: ${a(2)} - | - | **Default log level**: ${a(6)} - | - | **Description**: ${a(3)} - | - | **Resolution**: ${a(4)} - | - | **Retry strategy**: ${a(5)}""".stripMargin - } - - println(errorCategoriesTable.map(genSubsectionsForErrorCategory).mkString("\n\n\n")) - - println(errorCategoryTableText) - println() - println("Error category table done") + } + def genStatusCodeMigrationTableText(inputYamlResourcePath: String): String = { // Generation migration table val changes: Seq[Change] = parseErrorsYml( - "com/daml/platform/docs/self-service-error-codes-migration.yml" + inputYamlResourcePath ).toList // Group changes by service @@ -179,12 +81,6 @@ object SelfServiceErrorCodes_MigrationGuideGen_App { unsorted.sortBy(line => (line(0), line(1), line(2), line(3), line(4))) } - printOutAsCsvText(tableLines) - - println() - println() - println() - case class EndpointWithGrpcCode(serviceName: String, legacy_grpc_code: String) val affectedMap = mutable.Map[EndpointWithGrpcCode, mutable.ArrayBuffer[Array[String]]]() // Add all changed codes @@ -198,7 +94,7 @@ object SelfServiceErrorCodes_MigrationGuideGen_App { affectedMap.apply(key) += (line) } - // Add unchanged codes if the there is a change for this (endpoint, old_code) pair + // Add unchanged codes if the there is at least one change for the corresponding (endpoint, old_code) pair for { line <- tableLines if line(1) == line(2) } { @@ -213,20 +109,35 @@ object SelfServiceErrorCodes_MigrationGuideGen_App { (line(0), line(1), line(2), line(3), line(4)) ) - val reStTable = generateReStTable( - linesForTable, - header = Array( - "Service endpoint", - "gRPC status code (before SDK 1.18)", - "gRPC status code (since SDK 1.18)", - "Remarks", - "Ledger API error code ID", - ), - ) - println(reStTable) + linesForTable + .groupBy(_(0)) + .toList + .sortBy(_._1) + .map { case (endpoint: String, rows: Array[Array[String]]) => + val rows2 = (rows.map(_.tail)).sortBy(line => (line(0), line(1), line(2), line(3))) + val tableText = generateReStTable( + rows2, + header = Array( + // "Service endpoint", + "gRPC status code\n" + + "(before SDK 1.18)", + "gRPC status code\n" + + "(since SDK 1.18)", + "Remarks", + "Ledger API \n" + + "error code id", + ), + ) + s"""| + |$endpoint + |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + |""".stripMargin + "\n" + tableText + + } + .mkString("\n\n") } - private def printOutAsCsvText(tableLines: Array[Array[String]]): Unit = { + def printOutAsCsvText(tableLines: Array[Array[String]]): Unit = { val csvLines: Array[String] = for { line <- tableLines } yield { @@ -241,23 +152,73 @@ object SelfServiceErrorCodes_MigrationGuideGen_App { } def generateReStTable(rows: Array[Array[String]], header: Array[String]): String = { - val table: Array[Array[String]] = header +: rows - - val columnMaxLengths: Array[Int] = - table.transpose.map(column => column.map(_.length).max).map(_ + 1) + val table2d: Array[Array[String]] = header +: rows - def padRight(s: String, length: Int): String = { + def padRightF(s: String, length: Int): String = { require(s.length <= length, s"String |$s| is longer then target length: $length") s + (" " * (length - s.length)) } - val textTableRows: Array[String] = table.map { row => - val textTableRow: String = row.zipWithIndex - .map { case (entry, index) => - padRight(entry, columnMaxLengths(index)) + case class Cell(lines: mutable.ArrayBuffer[String]) { + def maxLength(): Int = { + lines.map(_.length).maxOption.getOrElse(0) + } + + def height(): Int = { + lines.length + } + + def padRight(targetLength: Int, targetHeight: Int): Cell = { + require( + targetHeight >= this.height(), + s"Cell ${this} has more lines than the max lines expected: ${targetHeight}!", + ) + val newLines = (1 to (targetHeight - this.height())).map(_ => padRightF("", targetLength)) + lines.mapInPlace(line => padRightF(line, targetLength)) + lines.addAll(newLines) + this + } + } + + def cellRowToTextRows(row: Array[Cell]): String = { + val table = row.map(_.lines.toArray).transpose + table.map(row => row.mkString("|", "|", "|")).mkString("\n") + } + + val table: Array[Array[Cell]] = table2d + .map(line => + line.map { cell: String => + val linesInCell: Array[String] = cell.split("\n") + Cell(lines = mutable.ArrayBuffer.from(linesInCell)) } - .mkString("|", "|", "|") - textTableRow + ) + + val columnMaxLengths: Array[Int] = + table + .filter(_.length != 1) + .transpose + .map(column => column.map(_.maxLength()).max) + .map(_ + 1) + + val totalLineWidthExclusiveOfOuterBorders = columnMaxLengths.sum + (columnMaxLengths.length - 1) + + val textTableRows: Array[String] = table.map { row => + if (row.length == 1) { + // If row has only one element it is the endpoint name that will span full table width. + row.head + .padRight(targetLength = totalLineWidthExclusiveOfOuterBorders, row.head.height()) + .lines + .map(l => s"|${l}|") + .mkString("\n") + } else { + val maxHeightInThisRow = row.map(_.height()).max + val paddedCells: Array[Cell] = row.zipWithIndex + .map { case (cell, index) => + cell.padRight(columnMaxLengths(index), maxHeightInThisRow) + } + cellRowToTextRows(paddedCells) + } + } val textTableRowSeparator = columnMaxLengths.map("-" * _).mkString("+", "+", "+") @@ -348,6 +309,130 @@ object SelfServiceErrorCodes_MigrationGuideGen_App { } json.asObject.get } + + // Generate error categories table + def genErrorCategoryTableText(): Unit = { + case class ErrorCategoryDoc( + description: Option[String], + resolution: Option[String], + retryStrategy: Option[String], + ) + + def handleErrorCategoryAnnotations(errorCategory: ErrorCategory): ErrorCategoryDoc = { + import scala.reflect.runtime.{universe => ru} + + val descriptionTypeName = classOf[Description].getTypeName.replace("$", ".") + val resolutionTypeName = classOf[Resolution].getTypeName.replace("$", ".") + val retryStrategyTypeName = classOf[RetryStrategy].getTypeName.replace("$", ".") + + val runtimeMirror: ru.Mirror = ru.runtimeMirror(this.getClass.getClassLoader) + + def isAnnotation(annotation: ru.Annotation, typeName: String): Boolean = + annotationTypeName(annotation) == typeName + + def annotationTypeName(annotation: ru.Annotation) = + annotation.tree.tpe.toString + + @SuppressWarnings(Array("org.wartremover.warts.AsInstanceOf")) + def parseAnnotationValue(tree: ru.Tree): String = { + try { + Seq(1).map( + tree.children(_).asInstanceOf[ru.Literal].value.value.asInstanceOf[String] + ) match { + case s :: Nil => s.stripMargin + case _ => sys.exit(1) + } + } catch { + case x: RuntimeException => + println( + "Failed to process description (description needs to be a constant-string. i.e. don't apply stripmargin here ...): " + tree.toString + ) + throw x + } + } + + val mirroredType = runtimeMirror.reflect(errorCategory) + val annotations: Seq[ru.Annotation] = mirroredType.symbol.annotations + + var description: Option[String] = None + var resolution: Option[String] = None + var retryStrategy: Option[String] = None + annotations.foreach { annotation => + if (isAnnotation(annotation, descriptionTypeName)) { + description = Option(parseAnnotationValue(annotation.tree)) + } else if (isAnnotation(annotation, resolutionTypeName)) { + resolution = Option(parseAnnotationValue(annotation.tree)) + } else if (isAnnotation(annotation, retryStrategyTypeName)) { + retryStrategy = Option(parseAnnotationValue(annotation.tree)) + } else { + ??? + } + } + + ErrorCategoryDoc( + description = description, + resolution = resolution, + retryStrategy = retryStrategy, + ) + + } + + val errorCategoriesTable: Array[Array[String]] = ErrorCategory.all.map { cat: ErrorCategory => + val doc = handleErrorCategoryAnnotations(cat) + println(doc) + val intValue: String = cat.asInt.toString + val grpcCode: String = cat.grpcCode.fold("N/A")(_.toString) + val name: String = cat.getClass.getSimpleName.replace("$", "") + val logLevel: String = cat.logLevel.toString + + Array( + name, + intValue, + grpcCode, + doc.description.getOrElse("").replace("\n", " "), + doc.resolution.getOrElse("").replace("\n", " "), + doc.retryStrategy.getOrElse("").replace("\n", " "), + logLevel, + ) + + }.toArray + + val errorCategoryTableText = generateReStTable( + errorCategoriesTable, + header = Array( + "Error category", + "Category id", + "gRPC code", + "Description", + "Resolution", + "Retry strategy", + "Log level", + ), + ) + + def genSubsectionsForErrorCategory(a: Array[String]) = { + s"""${a(0)} + |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | **Category id**: ${a(1)} + | + | **gRPC status code**: ${a(2)} + | + | **Default log level**: ${a(6)} + | + | **Description**: ${a(3)} + | + | **Resolution**: ${a(4)} + | + | **Retry strategy**: ${a(5)}""".stripMargin + } + + println(errorCategoriesTable.map(genSubsectionsForErrorCategory).mkString("\n\n\n")) + + println(errorCategoryTableText) + println() + println("Error category table done") + } + } case class Service(name: String, method: String) {