Skip to content

Commit

Permalink
[DPP-676][Self-service error codes] Adapt ApiConfigManagementService
Browse files Browse the repository at this point in the history
CHANGELOG_BEGIN
CHANGELOG_END
  • Loading branch information
pbatko-da committed Oct 27, 2021
1 parent 3031190 commit 411d3ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,7 @@ class FieldValidations private (errorFactories: ErrorFactories) {

}

/** Default implementation exposing field validations with the legacy error factories.
* TODO error codes: Remove default implementation once all consumers output versioned error codes.
*/
object FieldValidations extends FieldValidations(ErrorFactories) {
object FieldValidations {
def apply(errorFactories: ErrorFactories): FieldValidations =
new FieldValidations(errorFactories)
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import com.daml.logging.{ContextualizedLogger, LoggingContext}
import com.daml.platform.api.grpc.GrpcApiService
import com.daml.platform.apiserver.services.admin.ApiConfigManagementService._
import com.daml.platform.apiserver.services.logging
import com.daml.platform.server.api.validation.ErrorFactories
import com.daml.platform.server.api.{ValidationLogger, validation}
import com.daml.platform.server.api.ValidationLogger
import com.daml.platform.server.api.validation.{ErrorFactories, FieldValidations}
import com.daml.telemetry.{DefaultTelemetry, TelemetryContext}
import io.grpc.{ServerServiceDefinition, StatusRuntimeException}

Expand All @@ -52,6 +52,7 @@ private[apiserver] final class ApiConfigManagementService private (
new DamlContextualizedErrorLogger(logger, loggingContext, None)

private val errorFactories = ErrorFactories(errorCodesVersionSwitcher)
private val fieldValidations = FieldValidations(errorFactories)

import errorFactories._

Expand Down Expand Up @@ -172,7 +173,7 @@ private[apiserver] final class ApiConfigManagementService private (
)(implicit
contextualizedErrorLogger: ContextualizedErrorLogger
): Either[StatusRuntimeException, SetTimeModelParameters] = {
import validation.FieldValidations._
import fieldValidations._
for {
pTimeModel <- requirePresence(request.newTimeModel, "new_time_model")
pAvgTransactionLatency <- requirePresence(
Expand Down

0 comments on commit 411d3ab

Please sign in to comment.