File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
økonomi/application/src/main/kotlin/økonomi/application/utbetaling Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 1
1
package økonomi.application.utbetaling
2
2
3
3
import arrow.core.Either
4
+ import arrow.core.flatten
4
5
import arrow.core.getOrElse
5
6
import arrow.core.left
6
7
import arrow.core.right
@@ -51,7 +52,17 @@ class ResendUtbetalingService(
51
52
utbetalingsIder : List <UUID30 >,
52
53
): List <Either <KunneIkkeSendeUtbetalingP åNytt , Utbetaling .OversendtUtbetaling >> {
53
54
return utbetalingsIder.map { utbetalingId ->
54
- resendUtbetaling(utbetalingId)
55
+ Either .catch {
56
+ log.info(" Resend utbetaling: Resender utbetalingId $utbetalingId " )
57
+ resendUtbetaling(utbetalingId)
58
+ }.mapLeft {
59
+ log.error(
60
+ " Resend utbetaling: Ukjent feil. Kunne ikke resende utbetalingId $utbetalingId " ,
61
+ RuntimeException (" Trigger stacktrace for enklere debugging" ),
62
+ )
63
+ sikkerLogg.error(" Resend utbetaling: Ukjent feil. Kunne ikke resende utbetalingId $utbetalingId " , it)
64
+ KunneIkkeSendeUtbetalingP åNytt .UkjentFeil (utbetalingId)
65
+ }.flatten()
55
66
}.also {
56
67
log.info(" Resend utbetaling: ${it.count { it.isRight() }} av ${utbetalingsIder.size} utbetalinger ble sendt på nytt. $it " )
57
68
}
@@ -262,4 +273,8 @@ sealed interface KunneIkkeSendeUtbetalingPåNytt {
262
273
val sakId : UUID ,
263
274
val vedtakId : UUID ,
264
275
) : KunneIkkeSendeUtbetalingPåNytt
276
+
277
+ data class UkjentFeil (
278
+ override val utbetalingId : UUID30 ,
279
+ ) : KunneIkkeSendeUtbetalingPåNytt
265
280
}
You can’t perform that action at this time.
0 commit comments