diff --git a/src/main/kotlin/fr/dcproject/common/utils/Request.kt b/src/main/kotlin/fr/dcproject/common/utils/Request.kt index 296ce6d..39d8894 100644 --- a/src/main/kotlin/fr/dcproject/common/utils/Request.kt +++ b/src/main/kotlin/fr/dcproject/common/utils/Request.kt @@ -1,5 +1,6 @@ package fr.dcproject.common.utils +import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException import com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException import io.ktor.application.ApplicationCall import io.ktor.application.log @@ -17,7 +18,10 @@ public suspend inline fun ApplicationCall.receiveOrBadRequest( return try { receive(typeOf()) } catch (cause: MissingKotlinParameterException) { - application.log.debug("Conversion failed, throw bad exeption", cause) + application.log.debug("Conversion failed, throw bad exception", cause) + throw BadRequestException(message, cause) + } catch (cause: UnrecognizedPropertyException) { + application.log.debug("Conversion failed, throw bad exception", cause) throw BadRequestException(message, cause) } }