Skip to content

Commit

Permalink
catch errors as warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Mar 26, 2024
1 parent b44e144 commit d7aeced
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ public Integer call() throws Exception {

for (Link link : network.getLinks().values()) {
Feature ft = features.get(link.getId());
applyChanges(link, ft.junctionType(), ft.features());

try {
applyChanges(link, ft.junctionType(), ft.features());
} catch (IllegalArgumentException e) {
warn++;
log.warn("Error processing link {}", link.getId(), e);
}
}

log.warn("Observed {} warnings out of {} links", warn, network.getLinks().size());
Expand Down Expand Up @@ -132,7 +138,7 @@ private void applyChanges(Link link, String junctionType, Object2DoubleMap<Strin
case "right_before_left" -> 0.6;
// Motorways are kept at their max theoretical capacity
case "priority" -> type.startsWith("motorway") ? 1 : 0.8;
default -> throw new IllegalArgumentException("Unknown type: " + junctionType);
default -> 0;
};

if (perLane < cap * threshold) {
Expand Down

0 comments on commit d7aeced

Please sign in to comment.