Skip to content

Commit

Permalink
Correct error message when field are not passed when starting replica…
Browse files Browse the repository at this point in the history
…tion (#1292)
  • Loading branch information
monusingh-1 authored Dec 7, 2023
1 parent 577fd62 commit be24bfa
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,19 @@ class ReplicateIndexRequest : AcknowledgedRequest<ReplicateIndexRequest>, Indice
override fun validate(): ActionRequestValidationException? {

var validationException = ActionRequestValidationException()
if (!this::leaderAlias.isInitialized ||
!this::leaderIndex.isInitialized ||
!this::followerIndex.isInitialized) {
validationException.addValidationError("Mandatory params are missing for the request")
val missingFields: MutableList<String> = mutableListOf()
if (!this::leaderAlias.isInitialized){
missingFields.add("leader_alias")
}
if(!this::leaderIndex.isInitialized){
missingFields.add("leader_index")
}
if (!this::followerIndex.isInitialized){
missingFields.add("follower_index")
}
if(missingFields.isNotEmpty()){
validationException.addValidationError("Mandatory params $missingFields are missing for the request")
return validationException
}

validateName(leaderIndex, validationException)
Expand Down

0 comments on commit be24bfa

Please sign in to comment.