![JAR search and dependency download from the Maven repository](/logo.png)
com.icerockdev.exception.ValidationException.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of web-utils Show documentation
Show all versions of web-utils Show documentation
Ktor based web-server with validation and internationalization
The newest version!
/*
* Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/
package com.icerockdev.exception
import com.icerockdev.api.Request
import io.ktor.http.HttpStatusCode
import javax.validation.ConstraintViolation
class ValidationException(message: String = HttpStatusCode.UnprocessableEntity.description) :
ExtUserException(HttpStatusCode.UnprocessableEntity.value, message) {
constructor(constraintViolationList: Set>) : this() {
val errorList = mutableListOf()
for (constraintViolation in constraintViolationList) {
errorList.add(
ErrorDetail(
message = constraintViolation.message,
field = constraintViolation.propertyPath?.lastOrNull()?.name
)
)
}
setErrors(errorList)
}
constructor(errorList: List) : this() {
setErrors(errorList)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy