Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Håndter exception
Browse files Browse the repository at this point in the history
oddgfa committed Jun 10, 2024

Verified

This commit was signed with the committer’s verified signature.
oddgfa Odd Gunnar
1 parent e4e4963 commit b90996b
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ import no.nav.modiapersonoversikt.consumer.pdlPipApi.generated.models.PipPersond
import no.nav.modiapersonoversikt.infrastructure.cache.CacheUtils
import no.nav.modiapersonoversikt.infrastructure.ping.Pingable
import okhttp3.OkHttpClient
import org.slf4j.LoggerFactory
import org.springframework.cache.annotation.CacheConfig
import org.springframework.cache.annotation.Cacheable

@@ -34,6 +35,7 @@ open class PdlPipApiImpl(
private val cache: Cache<String, PipPersondataResponse?> = CacheUtils.createCache(),
) : PdlPipApi {
private val pdlPipApi = PIPTjenesteForPDLDataKunForSystemerApi(url, client)
private val logger = LoggerFactory.getLogger(this::class.java)

@Cacheable
override fun hentFnr(aktorId: AktorId): String? {
@@ -57,7 +59,12 @@ open class PdlPipApiImpl(

private fun hentIdenter(ident: String): PipPersondataResponse? {
return cache.get(ident) {
pdlPipApi.lookupIdent(ident)
runCatching {
pdlPipApi.lookupIdent(ident)
}.getOrElse {
logger.error("Failed to fetch data from pdl-pip-api", it)
null
}
}
}

0 comments on commit b90996b

Please sign in to comment.