mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
[User management] Make use of UM error group in the docs (#13260)
changelog_begin changelog_end
This commit is contained in:
parent
a27fa0c95a
commit
a8c0984d9b
@ -245,22 +245,6 @@ Errors raised by or forwarded by the Ledger API.
|
||||
|
||||
|
||||
|
||||
.. _error_code_CONFIGURATION_ENTRY_REJECTED:
|
||||
|
||||
CONFIGURATION_ENTRY_REJECTED
|
||||
---------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
**Explanation**: This rejection is given when a new configuration is rejected.
|
||||
|
||||
**Category**: InvalidGivenCurrentSystemStateOther
|
||||
|
||||
**Conveyance**: This error is logged with log-level INFO on the server side. This error is exposed on the API with grpc-status FAILED_PRECONDITION including a detailed error message
|
||||
|
||||
**Resolution**: Fetch newest configuration and/or retry.
|
||||
|
||||
|
||||
|
||||
|
||||
.. _error_code_LEDGER_API_INTERNAL_ERROR:
|
||||
|
||||
LEDGER_API_INTERNAL_ERROR
|
||||
@ -277,22 +261,6 @@ LEDGER_API_INTERNAL_ERROR
|
||||
|
||||
|
||||
|
||||
.. _error_code_PACKAGE_UPLOAD_REJECTED:
|
||||
|
||||
PACKAGE_UPLOAD_REJECTED
|
||||
---------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
**Explanation**: This rejection is given when a package upload is rejected.
|
||||
|
||||
**Category**: InvalidGivenCurrentSystemStateOther
|
||||
|
||||
**Conveyance**: This error is logged with log-level INFO on the server side. This error is exposed on the API with grpc-status FAILED_PRECONDITION including a detailed error message
|
||||
|
||||
**Resolution**: Refer to the detailed message of the received error.
|
||||
|
||||
|
||||
|
||||
|
||||
.. _error_code_PARTICIPANT_BACKPRESSURE:
|
||||
|
||||
PARTICIPANT_BACKPRESSURE
|
||||
@ -357,22 +325,6 @@ SERVICE_NOT_RUNNING
|
||||
|
||||
|
||||
|
||||
.. _error_code_TOO_MANY_USER_RIGHTS:
|
||||
|
||||
TOO_MANY_USER_RIGHTS
|
||||
---------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
**Explanation**: A user can have only a limited number of user rights. There was an attempt to create a user with too many rights or grant too many rights to a user.
|
||||
|
||||
**Category**: InvalidGivenCurrentSystemStateOther
|
||||
|
||||
**Conveyance**: This error is logged with log-level INFO on the server side. This error is exposed on the API with grpc-status FAILED_PRECONDITION including a detailed error message
|
||||
|
||||
**Resolution**: Retry with a smaller number of rights or delete some of the already existing rights of this user. Contact the participant operator if the limit is too low.
|
||||
|
||||
|
||||
|
||||
|
||||
.. _error_code_UNSUPPORTED_OPERATION:
|
||||
|
||||
UNSUPPORTED_OPERATION
|
||||
@ -388,6 +340,66 @@ UNSUPPORTED_OPERATION
|
||||
|
||||
|
||||
|
||||
2.2.1. ParticipantErrorGroup / LedgerApiErrors / AdminServices
|
||||
===================================================================================================================
|
||||
|
||||
Errors raised by Ledger API admin services.
|
||||
|
||||
|
||||
|
||||
.. _error_code_CONFIGURATION_ENTRY_REJECTED:
|
||||
|
||||
CONFIGURATION_ENTRY_REJECTED
|
||||
---------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
**Explanation**: This rejection is given when a new configuration is rejected.
|
||||
|
||||
**Category**: InvalidGivenCurrentSystemStateOther
|
||||
|
||||
**Conveyance**: This error is logged with log-level INFO on the server side. This error is exposed on the API with grpc-status FAILED_PRECONDITION including a detailed error message
|
||||
|
||||
**Resolution**: Fetch newest configuration and/or retry.
|
||||
|
||||
|
||||
|
||||
|
||||
.. _error_code_PACKAGE_UPLOAD_REJECTED:
|
||||
|
||||
PACKAGE_UPLOAD_REJECTED
|
||||
---------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
**Explanation**: This rejection is given when a package upload is rejected.
|
||||
|
||||
**Category**: InvalidGivenCurrentSystemStateOther
|
||||
|
||||
**Conveyance**: This error is logged with log-level INFO on the server side. This error is exposed on the API with grpc-status FAILED_PRECONDITION including a detailed error message
|
||||
|
||||
**Resolution**: Refer to the detailed message of the received error.
|
||||
|
||||
|
||||
|
||||
2.2.1.1. ParticipantErrorGroup / LedgerApiErrors / AdminServices / UserManagementServiceErrors
|
||||
===================================================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. _error_code_TOO_MANY_USER_RIGHTS:
|
||||
|
||||
TOO_MANY_USER_RIGHTS
|
||||
---------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
**Explanation**: A user can have only a limited number of user rights. There was an attempt to create a user with too many rights or grant too many rights to a user.
|
||||
|
||||
**Category**: InvalidGivenCurrentSystemStateOther
|
||||
|
||||
**Conveyance**: This error is logged with log-level INFO on the server side. This error is exposed on the API with grpc-status FAILED_PRECONDITION including a detailed error message
|
||||
|
||||
**Resolution**: Retry with a smaller number of rights or delete some of the already existing rights of this user. Contact the participant operator if the limit is too low.
|
||||
|
||||
|
||||
|
||||
|
||||
.. _error_code_USER_ALREADY_EXISTS:
|
||||
|
||||
@ -420,7 +432,7 @@ USER_NOT_FOUND
|
||||
|
||||
|
||||
|
||||
2.2.1. ParticipantErrorGroup / LedgerApiErrors / AuthorizationChecks
|
||||
2.2.2. ParticipantErrorGroup / LedgerApiErrors / AuthorizationChecks
|
||||
===================================================================================================================
|
||||
|
||||
Authentication and authorization errors.
|
||||
@ -490,7 +502,7 @@ UNAUTHENTICATED
|
||||
|
||||
|
||||
|
||||
2.2.2. ParticipantErrorGroup / LedgerApiErrors / CommandExecution
|
||||
2.2.3. ParticipantErrorGroup / LedgerApiErrors / CommandExecution
|
||||
===================================================================================================================
|
||||
|
||||
Errors raised during the command execution phase of the command submission evaluation.
|
||||
@ -512,7 +524,7 @@ FAILED_TO_DETERMINE_LEDGER_TIME
|
||||
|
||||
|
||||
|
||||
2.2.2.1. ParticipantErrorGroup / LedgerApiErrors / CommandExecution / Interpreter
|
||||
2.2.3.1. ParticipantErrorGroup / LedgerApiErrors / CommandExecution / Interpreter
|
||||
===================================================================================================================
|
||||
|
||||
Errors raised during the command interpretation phase of the command submission evaluation.
|
||||
@ -582,7 +594,7 @@ DAML_INTERPRETER_INVALID_ARGUMENT
|
||||
|
||||
|
||||
|
||||
2.2.2.1.1. ParticipantErrorGroup / LedgerApiErrors / CommandExecution / Interpreter / LookupErrors
|
||||
2.2.3.1.1. ParticipantErrorGroup / LedgerApiErrors / CommandExecution / Interpreter / LookupErrors
|
||||
===================================================================================================================
|
||||
|
||||
Errors raised in lookups during the command interpretation phase.
|
||||
@ -604,7 +616,7 @@ CONTRACT_KEY_NOT_FOUND
|
||||
|
||||
|
||||
|
||||
2.2.2.2. ParticipantErrorGroup / LedgerApiErrors / CommandExecution / Package
|
||||
2.2.3.2. ParticipantErrorGroup / LedgerApiErrors / CommandExecution / Package
|
||||
===================================================================================================================
|
||||
|
||||
Command execution errors raised due to invalid packages.
|
||||
@ -642,7 +654,7 @@ PACKAGE_VALIDATION_FAILED
|
||||
|
||||
|
||||
|
||||
2.2.2.3. ParticipantErrorGroup / LedgerApiErrors / CommandExecution / Preprocessing
|
||||
2.2.3.3. ParticipantErrorGroup / LedgerApiErrors / CommandExecution / Preprocessing
|
||||
===================================================================================================================
|
||||
|
||||
Errors raised during command conversion to the internal data representation.
|
||||
@ -664,7 +676,7 @@ COMMAND_PREPROCESSING_FAILED
|
||||
|
||||
|
||||
|
||||
2.2.3. ParticipantErrorGroup / LedgerApiErrors / ConsistencyErrors
|
||||
2.2.4. ParticipantErrorGroup / LedgerApiErrors / ConsistencyErrors
|
||||
===================================================================================================================
|
||||
|
||||
Potential consistency errors raised due to race conditions during command submission or returned as submission rejections by the backing ledger.
|
||||
@ -798,7 +810,7 @@ SUBMISSION_ALREADY_IN_FLIGHT
|
||||
|
||||
|
||||
|
||||
2.2.4. ParticipantErrorGroup / LedgerApiErrors / PackageServiceError
|
||||
2.2.5. ParticipantErrorGroup / LedgerApiErrors / PackageServiceError
|
||||
===================================================================================================================
|
||||
|
||||
Errors raised by the Package Management Service on package uploads.
|
||||
@ -852,7 +864,7 @@ PACKAGE_SERVICE_INTERNAL_ERROR
|
||||
|
||||
|
||||
|
||||
2.2.4.1. ParticipantErrorGroup / LedgerApiErrors / PackageServiceError / Reading
|
||||
2.2.5.1. ParticipantErrorGroup / LedgerApiErrors / PackageServiceError / Reading
|
||||
===================================================================================================================
|
||||
|
||||
Package parsing errors raised during package upload.
|
||||
@ -954,7 +966,7 @@ ZIP_BOMB
|
||||
|
||||
|
||||
|
||||
2.2.5. ParticipantErrorGroup / LedgerApiErrors / RequestValidation
|
||||
2.2.6. ParticipantErrorGroup / LedgerApiErrors / RequestValidation
|
||||
===================================================================================================================
|
||||
|
||||
Validation errors raised when evaluating requests in the Ledger API.
|
||||
@ -1104,7 +1116,7 @@ PARTICIPANT_PRUNED_DATA_ACCESSED
|
||||
|
||||
|
||||
|
||||
2.2.5.1. ParticipantErrorGroup / LedgerApiErrors / RequestValidation / NotFound
|
||||
2.2.6.1. ParticipantErrorGroup / LedgerApiErrors / RequestValidation / NotFound
|
||||
===================================================================================================================
|
||||
|
||||
|
||||
@ -1158,7 +1170,7 @@ TRANSACTION_NOT_FOUND
|
||||
|
||||
|
||||
|
||||
2.2.6. ParticipantErrorGroup / LedgerApiErrors / WriteServiceRejections
|
||||
2.2.7. ParticipantErrorGroup / LedgerApiErrors / WriteServiceRejections
|
||||
===================================================================================================================
|
||||
|
||||
Generic submission rejection errors returned by the backing ledger's write service.
|
||||
@ -1248,7 +1260,7 @@ SUBMITTING_PARTY_NOT_KNOWN_ON_LEDGER
|
||||
|
||||
|
||||
|
||||
2.2.6.1. ParticipantErrorGroup / LedgerApiErrors / WriteServiceRejections / Internal
|
||||
2.2.7.1. ParticipantErrorGroup / LedgerApiErrors / WriteServiceRejections / Internal
|
||||
===================================================================================================================
|
||||
|
||||
Errors that arise from an internal system misbehavior.
|
||||
|
@ -15,7 +15,9 @@ object ErrorGroups {
|
||||
abstract class LedgerApiErrorGroup extends ErrorGroup() {
|
||||
abstract class CommandExecutionErrorGroup extends ErrorGroup()
|
||||
abstract class PackageServiceErrorGroup extends ErrorGroup()
|
||||
abstract class UserManagementServiceErrorGroup extends ErrorGroup()
|
||||
abstract class AdminServicesErrorGroup extends ErrorGroup() {
|
||||
abstract class UserManagementServiceErrorGroup extends ErrorGroup()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ import scala.concurrent.duration._
|
||||
)
|
||||
object LedgerApiErrors extends LedgerApiErrorGroup {
|
||||
|
||||
val Admin: groups.AdminServices.type = groups.AdminServices
|
||||
|
||||
val EarliestOffsetMetadataKey = "earliest_offset"
|
||||
|
||||
@Explanation(
|
||||
@ -717,100 +719,6 @@ object LedgerApiErrors extends LedgerApiErrorGroup {
|
||||
) extends DamlErrorWithDefiniteAnswer(cause = message, throwableO = throwableO)
|
||||
}
|
||||
|
||||
@Explanation("Errors raised by Ledger API admin services.")
|
||||
object AdminServices {
|
||||
@Explanation("This rejection is given when a new configuration is rejected.")
|
||||
@Resolution("Fetch newest configuration and/or retry.")
|
||||
object ConfigurationEntryRejected
|
||||
extends ErrorCode(
|
||||
id = "CONFIGURATION_ENTRY_REJECTED",
|
||||
ErrorCategory.InvalidGivenCurrentSystemStateOther,
|
||||
) {
|
||||
case class Reject(_message: String)(implicit
|
||||
loggingContext: ContextualizedErrorLogger
|
||||
) extends DamlErrorWithDefiniteAnswer(
|
||||
cause = _message
|
||||
)
|
||||
}
|
||||
|
||||
@Explanation("This rejection is given when a package upload is rejected.")
|
||||
@Resolution("Refer to the detailed message of the received error.")
|
||||
object PackageUploadRejected
|
||||
extends ErrorCode(
|
||||
id = "PACKAGE_UPLOAD_REJECTED",
|
||||
ErrorCategory.InvalidGivenCurrentSystemStateOther,
|
||||
) {
|
||||
case class Reject(_message: String)(implicit
|
||||
loggingContext: ContextualizedErrorLogger
|
||||
) extends DamlErrorWithDefiniteAnswer(
|
||||
cause = _message
|
||||
)
|
||||
}
|
||||
|
||||
@Explanation("The user referred to by the request was not found.")
|
||||
@Resolution(
|
||||
"Check that you are connecting to the right participant node and the user-id is spelled correctly, if yes, create the user."
|
||||
)
|
||||
object UserNotFound
|
||||
extends ErrorCode(
|
||||
id = "USER_NOT_FOUND",
|
||||
ErrorCategory.InvalidGivenCurrentSystemStateResourceMissing,
|
||||
) {
|
||||
case class Reject(_operation: String, userId: String)(implicit
|
||||
loggingContext: ContextualizedErrorLogger
|
||||
) extends DamlErrorWithDefiniteAnswer(
|
||||
cause = s"${_operation} failed for unknown user \"${userId}\""
|
||||
) {
|
||||
override def resources: Seq[(ErrorResource, String)] = Seq(
|
||||
ErrorResource.User -> userId
|
||||
)
|
||||
}
|
||||
}
|
||||
@Explanation("There already exists a user with the same user-id.")
|
||||
@Resolution(
|
||||
"Check that you are connecting to the right participant node and the user-id is spelled correctly, or use the user that already exists."
|
||||
)
|
||||
object UserAlreadyExists
|
||||
extends ErrorCode(
|
||||
id = "USER_ALREADY_EXISTS",
|
||||
ErrorCategory.InvalidGivenCurrentSystemStateResourceExists,
|
||||
) {
|
||||
case class Reject(_operation: String, userId: String)(implicit
|
||||
loggingContext: ContextualizedErrorLogger
|
||||
) extends DamlErrorWithDefiniteAnswer(
|
||||
cause = s"${_operation} failed, as user \"${userId}\" already exists"
|
||||
) {
|
||||
override def resources: Seq[(ErrorResource, String)] = Seq(
|
||||
ErrorResource.User -> userId
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Explanation(
|
||||
"""|A user can have only a limited number of user rights.
|
||||
|There was an attempt to create a user with too many rights or grant too many rights to a user."""
|
||||
)
|
||||
@Resolution(
|
||||
"""|Retry with a smaller number of rights or delete some of the already existing rights of this user.
|
||||
|Contact the participant operator if the limit is too low."""
|
||||
)
|
||||
object TooManyUserRights
|
||||
extends ErrorCode(
|
||||
id = "TOO_MANY_USER_RIGHTS",
|
||||
ErrorCategory.InvalidGivenCurrentSystemStateOther,
|
||||
) {
|
||||
case class Reject(_operation: String, userId: String)(implicit
|
||||
loggingContext: ContextualizedErrorLogger
|
||||
) extends DamlErrorWithDefiniteAnswer(
|
||||
cause = s"${_operation} failed, as user \"${userId}\" would have too many rights."
|
||||
) {
|
||||
override def resources: Seq[(ErrorResource, String)] = Seq(
|
||||
ErrorResource.User -> userId
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Explanation(
|
||||
"Potential consistency errors raised due to race conditions during command submission or returned as submission rejections by the backing ledger."
|
||||
)
|
||||
|
@ -0,0 +1,46 @@
|
||||
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package com.daml.error.definitions.groups
|
||||
|
||||
import com.daml.error.{ContextualizedErrorLogger, ErrorCategory, ErrorCode, Explanation, Resolution}
|
||||
import com.daml.error.definitions.{DamlErrorWithDefiniteAnswer, LedgerApiErrors, groups}
|
||||
|
||||
@Explanation("Errors raised by Ledger API admin services.")
|
||||
object AdminServices extends LedgerApiErrors.AdminServicesErrorGroup {
|
||||
|
||||
val UserManagement: groups.UserManagementServiceErrors.type = groups.UserManagementServiceErrors
|
||||
|
||||
@Explanation("This rejection is given when a new configuration is rejected.")
|
||||
@Resolution("Fetch newest configuration and/or retry.")
|
||||
object ConfigurationEntryRejected
|
||||
extends ErrorCode(
|
||||
id = "CONFIGURATION_ENTRY_REJECTED",
|
||||
ErrorCategory.InvalidGivenCurrentSystemStateOther,
|
||||
) {
|
||||
|
||||
case class Reject(_message: String)(implicit
|
||||
loggingContext: ContextualizedErrorLogger
|
||||
) extends DamlErrorWithDefiniteAnswer(
|
||||
cause = _message
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
@Explanation("This rejection is given when a package upload is rejected.")
|
||||
@Resolution("Refer to the detailed message of the received error.")
|
||||
object PackageUploadRejected
|
||||
extends ErrorCode(
|
||||
id = "PACKAGE_UPLOAD_REJECTED",
|
||||
ErrorCategory.InvalidGivenCurrentSystemStateOther,
|
||||
) {
|
||||
|
||||
case class Reject(_message: String)(implicit
|
||||
loggingContext: ContextualizedErrorLogger
|
||||
) extends DamlErrorWithDefiniteAnswer(
|
||||
cause = _message
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package com.daml.error.definitions.groups
|
||||
|
||||
import com.daml.error.definitions.DamlErrorWithDefiniteAnswer
|
||||
import com.daml.error.{
|
||||
ContextualizedErrorLogger,
|
||||
ErrorCategory,
|
||||
ErrorCode,
|
||||
ErrorResource,
|
||||
Explanation,
|
||||
Resolution,
|
||||
}
|
||||
|
||||
object UserManagementServiceErrors extends AdminServices.UserManagementServiceErrorGroup {
|
||||
|
||||
@Explanation("The user referred to by the request was not found.")
|
||||
@Resolution(
|
||||
"Check that you are connecting to the right participant node and the user-id is spelled correctly, if yes, create the user."
|
||||
)
|
||||
object UserNotFound
|
||||
extends ErrorCode(
|
||||
id = "USER_NOT_FOUND",
|
||||
ErrorCategory.InvalidGivenCurrentSystemStateResourceMissing,
|
||||
) {
|
||||
case class Reject(_operation: String, userId: String)(implicit
|
||||
loggingContext: ContextualizedErrorLogger
|
||||
) extends DamlErrorWithDefiniteAnswer(
|
||||
cause = s"${_operation} failed for unknown user \"${userId}\""
|
||||
) {
|
||||
override def resources: Seq[(ErrorResource, String)] = Seq(
|
||||
ErrorResource.User -> userId
|
||||
)
|
||||
}
|
||||
}
|
||||
@Explanation("There already exists a user with the same user-id.")
|
||||
@Resolution(
|
||||
"Check that you are connecting to the right participant node and the user-id is spelled correctly, or use the user that already exists."
|
||||
)
|
||||
object UserAlreadyExists
|
||||
extends ErrorCode(
|
||||
id = "USER_ALREADY_EXISTS",
|
||||
ErrorCategory.InvalidGivenCurrentSystemStateResourceExists,
|
||||
) {
|
||||
case class Reject(_operation: String, userId: String)(implicit
|
||||
loggingContext: ContextualizedErrorLogger
|
||||
) extends DamlErrorWithDefiniteAnswer(
|
||||
cause = s"${_operation} failed, as user \"${userId}\" already exists"
|
||||
) {
|
||||
override def resources: Seq[(ErrorResource, String)] = Seq(
|
||||
ErrorResource.User -> userId
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Explanation(
|
||||
"""|A user can have only a limited number of user rights.
|
||||
|There was an attempt to create a user with too many rights or grant too many rights to a user."""
|
||||
)
|
||||
@Resolution(
|
||||
"""|Retry with a smaller number of rights or delete some of the already existing rights of this user.
|
||||
|Contact the participant operator if the limit is too low."""
|
||||
)
|
||||
object TooManyUserRights
|
||||
extends ErrorCode(
|
||||
id = "TOO_MANY_USER_RIGHTS",
|
||||
ErrorCategory.InvalidGivenCurrentSystemStateOther,
|
||||
) {
|
||||
case class Reject(_operation: String, userId: String)(implicit
|
||||
loggingContext: ContextualizedErrorLogger
|
||||
) extends DamlErrorWithDefiniteAnswer(
|
||||
cause = s"${_operation} failed, as user \"${userId}\" would have too many rights."
|
||||
) {
|
||||
override def resources: Seq[(ErrorResource, String)] = Seq(
|
||||
ErrorResource.User -> userId
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -19,7 +19,7 @@ class ErrorDetailsSpec extends AnyFlatSpec with Matchers {
|
||||
it should "correctly match exception to error codes " in {
|
||||
val securitySensitive =
|
||||
LedgerApiErrors.AuthorizationChecks.Unauthenticated.MissingJwtToken()(errorLogger).asGrpcError
|
||||
val notSecuritySensitive = LedgerApiErrors.AdminServices.UserNotFound
|
||||
val notSecuritySensitive = LedgerApiErrors.Admin.UserManagement.UserNotFound
|
||||
.Reject(_operation = "operation123", userId = "userId123")(errorLogger)
|
||||
.asGrpcError
|
||||
|
||||
@ -29,13 +29,16 @@ class ErrorDetailsSpec extends AnyFlatSpec with Matchers {
|
||||
) shouldBe false
|
||||
ErrorDetails.matches(
|
||||
notSecuritySensitive,
|
||||
LedgerApiErrors.AdminServices.UserNotFound,
|
||||
LedgerApiErrors.Admin.UserManagement.UserNotFound,
|
||||
) shouldBe true
|
||||
ErrorDetails.matches(
|
||||
new StatusRuntimeException(Status.ABORTED),
|
||||
LedgerApiErrors.AdminServices.UserNotFound,
|
||||
LedgerApiErrors.Admin.UserManagement.UserNotFound,
|
||||
) shouldBe false
|
||||
ErrorDetails.matches(
|
||||
new Exception,
|
||||
LedgerApiErrors.Admin.UserManagement.UserNotFound,
|
||||
) shouldBe false
|
||||
ErrorDetails.matches(new Exception, LedgerApiErrors.AdminServices.UserNotFound) shouldBe false
|
||||
|
||||
object NonGrpcErrorCode
|
||||
extends ErrorCode(
|
||||
|
@ -33,7 +33,7 @@ class UserManagementService(channel: Channel, authorizationToken: Option[String]
|
||||
val rights = userRights(observerPartyNames, signatoryPartyName)
|
||||
createUser(userId, rights).recoverWith {
|
||||
case e: StatusRuntimeException
|
||||
if ErrorDetails.matches(e, LedgerApiErrors.AdminServices.UserAlreadyExists) =>
|
||||
if ErrorDetails.matches(e, LedgerApiErrors.Admin.UserManagement.UserAlreadyExists) =>
|
||||
logger.info(
|
||||
s"Benchmark user already exists (received error: ${e.getStatus.getDescription}) so granting rights the existing user."
|
||||
)
|
||||
|
@ -281,7 +281,7 @@ class ErrorFactoriesSpec
|
||||
|
||||
"return the configurationEntryRejected" in {
|
||||
val msg = s"CONFIGURATION_ENTRY_REJECTED(9,$truncatedCorrelationId): message123"
|
||||
assertError(LedgerApiErrors.AdminServices.ConfigurationEntryRejected.Reject("message123"))(
|
||||
assertError(LedgerApiErrors.Admin.ConfigurationEntryRejected.Reject("message123"))(
|
||||
code = Code.FAILED_PRECONDITION,
|
||||
message = msg,
|
||||
details = Seq[ErrorDetails.ErrorDetail](
|
||||
|
@ -70,7 +70,7 @@ trait UserManagementTestContext {
|
||||
)
|
||||
.map(_ => ())
|
||||
.recover {
|
||||
case e if ErrorDetails.matches(e, LedgerApiErrors.AdminServices.UserNotFound) =>
|
||||
case e if ErrorDetails.matches(e, LedgerApiErrors.Admin.UserManagement.UserNotFound) =>
|
||||
()
|
||||
}
|
||||
)
|
||||
|
@ -176,7 +176,7 @@ final class ConfigManagementServiceIT extends LedgerTestSuite {
|
||||
// if the "looser" command fails after command submission (the winner completed after looser did submit the configuration change)
|
||||
assertGrpcError(
|
||||
failure,
|
||||
LedgerApiErrors.AdminServices.ConfigurationEntryRejected,
|
||||
LedgerApiErrors.Admin.ConfigurationEntryRejected,
|
||||
Some("Generation mismatch"),
|
||||
)
|
||||
} match {
|
||||
|
@ -61,7 +61,7 @@ final class UserManagementServiceIT extends LedgerTestSuite {
|
||||
def assertTooManyUserRightsError(t: Throwable): Unit = {
|
||||
assertGrpcError(
|
||||
t = t,
|
||||
errorCode = LedgerApiErrors.AdminServices.TooManyUserRights,
|
||||
errorCode = LedgerApiErrors.Admin.UserManagement.TooManyUserRights,
|
||||
exceptionMessageSubstring = None,
|
||||
)
|
||||
}
|
||||
@ -207,7 +207,7 @@ final class UserManagementServiceIT extends LedgerTestSuite {
|
||||
if !ErrorDetails.matchesOneOf(
|
||||
t,
|
||||
IndexErrors.DatabaseErrors.SqlTransientError,
|
||||
LedgerApiErrors.AdminServices.UserAlreadyExists,
|
||||
LedgerApiErrors.Admin.UserManagement.UserAlreadyExists,
|
||||
)
|
||||
&& !ErrorDetails.isInternalError(t) =>
|
||||
t
|
||||
@ -246,7 +246,7 @@ final class UserManagementServiceIT extends LedgerTestSuite {
|
||||
if !ErrorDetails.matchesOneOf(
|
||||
t,
|
||||
IndexErrors.DatabaseErrors.SqlTransientError,
|
||||
LedgerApiErrors.AdminServices.UserNotFound,
|
||||
LedgerApiErrors.Admin.UserManagement.UserNotFound,
|
||||
) && !ErrorDetails.isInternalError(t) =>
|
||||
t
|
||||
}
|
||||
@ -448,7 +448,7 @@ final class UserManagementServiceIT extends LedgerTestSuite {
|
||||
_ = assertUserAbsentIn(
|
||||
newUser,
|
||||
pageAfterDelete,
|
||||
"new user should be absent after it's delteion",
|
||||
"new user should be absent after it's deletion",
|
||||
)
|
||||
} yield {
|
||||
()
|
||||
@ -717,7 +717,7 @@ final class UserManagementServiceIT extends LedgerTestSuite {
|
||||
private def assertUserNotFound(t: Throwable): Unit = {
|
||||
assertGrpcError(
|
||||
t = t,
|
||||
errorCode = LedgerApiErrors.AdminServices.UserNotFound,
|
||||
errorCode = LedgerApiErrors.Admin.UserManagement.UserNotFound,
|
||||
exceptionMessageSubstring = None,
|
||||
)
|
||||
}
|
||||
@ -727,7 +727,7 @@ final class UserManagementServiceIT extends LedgerTestSuite {
|
||||
): Unit = {
|
||||
assertGrpcError(
|
||||
t = t,
|
||||
errorCode = LedgerApiErrors.AdminServices.UserAlreadyExists,
|
||||
errorCode = LedgerApiErrors.Admin.UserManagement.UserAlreadyExists,
|
||||
exceptionMessageSubstring = None,
|
||||
)
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ private[apiserver] object ApiConfigManagementService {
|
||||
submissionId: Ref.SubmissionId
|
||||
): PartialFunction[ConfigurationEntry, StatusRuntimeException] = {
|
||||
case domain.ConfigurationEntry.Rejected(`submissionId`, reason, _) =>
|
||||
LedgerApiErrors.AdminServices.ConfigurationEntryRejected
|
||||
LedgerApiErrors.Admin.ConfigurationEntryRejected
|
||||
.Reject(reason)(
|
||||
new DamlContextualizedErrorLogger(logger, loggingContext, Some(submissionId))
|
||||
)
|
||||
|
@ -202,7 +202,7 @@ private[apiserver] object ApiPackageManagementService {
|
||||
submissionId: Ref.SubmissionId
|
||||
): PartialFunction[PackageEntry, StatusRuntimeException] = {
|
||||
case PackageEntry.PackageUploadRejected(`submissionId`, _, reason) =>
|
||||
LedgerApiErrors.AdminServices.PackageUploadRejected
|
||||
LedgerApiErrors.Admin.PackageUploadRejected
|
||||
.Reject(reason)(
|
||||
new DamlContextualizedErrorLogger(logger, loggingContext, Some(submissionId))
|
||||
)
|
||||
|
@ -181,17 +181,23 @@ private[apiserver] final class ApiUserManagementService(
|
||||
result match {
|
||||
case Left(UserManagementStore.UserNotFound(id)) =>
|
||||
Future.failed(
|
||||
LedgerApiErrors.AdminServices.UserNotFound.Reject(operation, id.toString).asGrpcError
|
||||
LedgerApiErrors.Admin.UserManagement.UserNotFound
|
||||
.Reject(operation, id.toString)
|
||||
.asGrpcError
|
||||
)
|
||||
|
||||
case Left(UserManagementStore.UserExists(id)) =>
|
||||
Future.failed(
|
||||
LedgerApiErrors.AdminServices.UserAlreadyExists.Reject(operation, id.toString).asGrpcError
|
||||
LedgerApiErrors.Admin.UserManagement.UserAlreadyExists
|
||||
.Reject(operation, id.toString)
|
||||
.asGrpcError
|
||||
)
|
||||
|
||||
case Left(UserManagementStore.TooManyUserRights(id)) =>
|
||||
Future.failed(
|
||||
LedgerApiErrors.AdminServices.TooManyUserRights.Reject(operation, id: String).asGrpcError
|
||||
LedgerApiErrors.Admin.UserManagement.TooManyUserRights
|
||||
.Reject(operation, id: String)
|
||||
.asGrpcError
|
||||
)
|
||||
|
||||
case scala.util.Right(t) =>
|
||||
|
Loading…
Reference in New Issue
Block a user