Skip to content

Commit 53143cc

Browse files
author
Andrii Bondarchuk
committed
Tiny improvement
1 parent 1199c1b commit 53143cc

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

src/FitSyncHub.Zwift/Providers/ZwiftRoutesFromZwiftWADFilesProvider.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ public sealed class ZwiftRoutesFromZwiftWADFilesProvider : IZwiftRoutesProvider
4747
{"The Pretzel", "Watopia Pretzel"},
4848
};
4949

50+
private static readonly HashSet<string> s_knownMissingHomedataRoutes = [
51+
"Zwift Bambino Fondo 2022",
52+
"Zwift Medio Fondo 2022",
53+
"Zwift Gran Fondo 2022",
54+
"France Classic Fondo",
55+
"2022 Cycling Esports World Championships Route",
56+
"InnsbruckConti",
57+
];
58+
5059
private readonly ZwiftWadDecoder _zwiftWadDecoder;
5160
private readonly ILogger<ZwiftRoutesFromZwiftWADFilesProvider> _logger;
5261
private readonly string _unpackedWADFilesDirectory;
@@ -190,11 +199,21 @@ private IEnumerable<ZwiftDataWorldRoutePair> ReadRouteFilesAndParse(
190199
}
191200
}
192201

193-
if (routeXmlDTO == null || homedataXmlDTO == null)
202+
if (routeXmlDTO == null)
203+
{
204+
throw new InvalidDataException($"Route XML element not found in file {filePath}");
205+
}
206+
207+
if (homedataXmlDTO == null)
194208
{
195-
_logger.LogWarning("Skipping route file {FilePath} due to missing route or homedata, route: {Route}",
209+
if (!s_knownMissingHomedataRoutes.Contains(routeXmlDTO.Name))
210+
{
211+
throw new InvalidDataException($"Homedata XML element not found in file {filePath}");
212+
}
213+
214+
_logger.LogInformation("Skipping route file {FilePath} due to known missing homedata, route: {Route}",
196215
filePath,
197-
routeXmlDTO?.Name);
216+
routeXmlDTO.Name);
198217
continue;
199218
}
200219

0 commit comments

Comments
 (0)