All Downloads are FREE. Search and download functionalities are using the official Maven repository.

br.com.guiabolso.events.server.exception.handler.BadProtocolExceptionHandler.kt Maven / Gradle / Ivy

There is a newer version: 8.0.4
Show newest version
package br.com.guiabolso.events.server.exception.handler

import br.com.guiabolso.events.builder.EventBuilder.Companion.badProtocol
import br.com.guiabolso.events.exception.EventValidationException
import br.com.guiabolso.events.model.EventMessage
import br.com.guiabolso.events.model.RequestEvent
import br.com.guiabolso.events.model.ResponseEvent
import br.com.guiabolso.tracing.Tracer

object BadProtocolExceptionHandler : EventExceptionHandler {

    override suspend fun handleException(
        exception: EventValidationException,
        event: RequestEvent,
        tracer: Tracer
    ): ResponseEvent {
        tracer.notifyError(exception, false)
        return badProtocol(
            EventMessage(
                "INVALID_COMMUNICATION_PROTOCOL",
                mapOf("propertyName" to exception.propertyName)
            )
        )
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy