Skip to content

Commit f535914

Browse files
committed
Produce more readable error message in case timing place label match not found
for Hastus import file.
1 parent 2ec0a38 commit f535914

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/main/kotlin/fi/hsl/jore4/hastus/service/importing/CannotFindJourneyPatternRefByTimingPlaceLabelsException.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,15 @@ class CannotFindJourneyPatternRefByTimingPlaceLabelsException(
2121
2222
Trip label: ${routeIdentifier.routeLabel},
2323
Trip direction: ${routeIdentifier.direction.wellKnownNumber},
24-
Stop points: $stopLabels,
25-
Place codes: ${placeCodes.map { /* replace nulls with empty strings */ it ?: "" }}
24+
Stop points with place codes: ${
25+
stopLabels
26+
.zip(placeCodes)
27+
.map { (stopLabel, nullablePlaceCode) ->
28+
nullablePlaceCode
29+
?.let { "$stopLabel:$it" }
30+
?: stopLabel
31+
}
32+
}
2633
""".trimIndent()
2734
)
2835
}

src/test/kotlin/fi/hsl/jore4/hastus/api/ImportControllerTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ class ImportControllerTest @Autowired constructor(
175175
176176
Trip label: 123,
177177
Trip direction: 1,
178-
Stop points: [H1000, H1001, H1002],
179-
Place codes: [1PLACE, , 2PLACE]
178+
Stop points with place codes: [H1000:1PLACE, H1001, H1002:2PLACE]
180179
""".trimIndent()
181180
)
182181
)

0 commit comments

Comments
 (0)