
com.icerockdev.exception.BadRequestException.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
/*
* Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/
package com.icerockdev.exception
import com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException
import io.ktor.http.HttpStatusCode
class BadRequestException(message: String = HttpStatusCode.BadRequest.description) :
ExtUserException(HttpStatusCode.BadRequest.value, message) {
constructor(exception: MissingKotlinParameterException) : this() {
val fieldName = exception.path.joinToString(separator = ".") { it.fieldName ?: "[]" }
setErrors(listOf(ErrorDetail(message = "Property $fieldName are required", field = fieldName)))
}
constructor(errorList: List) : this() {
setErrors(errorList)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy