Skip to content

Commit

Permalink
Merge pull request #83 from navikt/logging-exception-in-simulation
Browse files Browse the repository at this point in the history
logg request detaljer og feilmelding hvis simuleringsrequesten feiler
  • Loading branch information
antonfofanov authored Jan 23, 2024
2 parents c3fded6 + 3de4519 commit 94f498a
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import no.nav.tjenestepensjon.simulering.v2.models.response.SimulerOffentligTjen
import no.nav.tjenestepensjon.simulering.v2.rest.RestClient
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import org.springframework.web.reactive.function.client.WebClientResponseException

@Service
class SimuleringServiceV2(
Expand All @@ -28,8 +29,15 @@ class SimuleringServiceV2(

request.tpForholdListe = buildTpForhold(opptjeningsperiodeResponse.tpOrdningOpptjeningsperiodeMap)
request.sisteTpnr = tpOrdning.tpId
log.debug("Populated request: ${SimuleringEndpoint.filterFnr(request.toString())}")
return restClient.getResponse(request = request, tpOrdning = tpOrdning, tpLeverandor = tpLeverandor)
val requestWithFilteredFnr = SimuleringEndpoint.filterFnr(request.toString())
log.debug("Populated request: $requestWithFilteredFnr")
return try{
restClient.getResponse(request = request, tpOrdning = tpOrdning, tpLeverandor = tpLeverandor)
}
catch (e: WebClientResponseException){
log.error("Error <${e.responseBodyAsString}> while calling ${tpLeverandor.name} with request: $requestWithFilteredFnr", e)
throw e
}
}

private fun buildTpForhold(tpOrdningOpptjeningsperiodeMap: TPOrdningOpptjeningsperiodeMap) =
Expand Down

0 comments on commit 94f498a

Please sign in to comment.