From 3746bd0c5d6bd72b3b17d90fc0e7b010423010b3 Mon Sep 17 00:00:00 2001 From: kwahlin Date: Mon, 20 Nov 2023 14:37:06 +0100 Subject: [PATCH] Handle and report exceptions --- .../script.groovy | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/whelktool/scripts/2023/05/lxl-2512-move-contribution-by-relator-domain/script.groovy b/whelktool/scripts/2023/05/lxl-2512-move-contribution-by-relator-domain/script.groovy index 431ff6d490..ff7cd74958 100644 --- a/whelktool/scripts/2023/05/lxl-2512-move-contribution-by-relator-domain/script.groovy +++ b/whelktool/scripts/2023/05/lxl-2512-move-contribution-by-relator-domain/script.groovy @@ -1,6 +1,9 @@ // LXL-2512: Move contribution by relator domain + import whelk.converter.marc.ContributionByRoleStep +unhandled = getReportWriter('unhandled.txt') + ruleSets = getWhelk().marcFrameConverter.conversion.marcRuleSets contribStep = ruleSets.bib.postProcSteps.find { it instanceof ContributionByRoleStep } @@ -12,8 +15,12 @@ def where = """ selectBySqlWhere(where) { def instance = it.graph[1] - def instanceType = instance[TYPE] - if (contribStep.moveRoles(instance)) { - it.scheduleSave() + + try { + if (contribStep.moveRoles(instance)) { + it.scheduleSave() + } + } catch (Exception e) { + unhandled.println("${it.doc.shortId}: ${e}") } }