File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/main/kotlin/no/nav/tms/varsel/api Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import io.ktor.server.response.*
18
18
import io.ktor.server.routing.*
19
19
import io.github.oshai.kotlinlogging.KotlinLogging
20
20
import io.ktor.serialization.jackson.*
21
+ import io.ktor.server.plugins.*
21
22
import no.nav.tms.common.metrics.installTmsMicrometerMetrics
22
23
import no.nav.tms.token.support.idporten.sidecar.LevelOfAssurance
23
24
import no.nav.tms.token.support.idporten.sidecar.idPorten
@@ -47,12 +48,18 @@ fun Application.varselApi(
47
48
}
48
49
) {
49
50
val securelog = KotlinLogging .logger(" secureLog" )
51
+ val log = KotlinLogging .logger{}
50
52
51
53
install(DefaultHeaders )
52
-
53
54
authInstaller()
54
55
55
56
install(StatusPages ) {
57
+ exception<BadRequestException > { call, cause ->
58
+ log.error { " 400 bad request" }
59
+ call.respond(
60
+ HttpStatusCode .BadRequest
61
+ )
62
+ }
56
63
exception<Throwable > { call, cause ->
57
64
securelog.warn(cause) { " Kall til ${call.request.uri} feilet: ${cause.message} " }
58
65
call.respond(HttpStatusCode .InternalServerError )
You can’t perform that action at this time.
0 commit comments