diff --git a/src/main/java/com/conveyal/r5/transit/TransportNetworkCache.java b/src/main/java/com/conveyal/r5/transit/TransportNetworkCache.java index c67fe9d24..a9f5284ca 100644 --- a/src/main/java/com/conveyal/r5/transit/TransportNetworkCache.java +++ b/src/main/java/com/conveyal/r5/transit/TransportNetworkCache.java @@ -197,7 +197,7 @@ private TransportNetworkConfig loadNetworkConfig (String networkId) { * If we did not find a cached network, build one from the input files. Should throw an exception rather than * returning null if for any reason it can't finish building one. */ - private @Nonnull TransportNetwork buildNetwork (String networkId) { + private @Nonnull TransportNetwork buildNetwork(String networkId) throws IOException { TransportNetwork network; TransportNetworkConfig networkConfig = loadNetworkConfig(networkId); if (networkConfig == null) { @@ -225,14 +225,10 @@ private TransportNetworkConfig loadNetworkConfig (String networkId) { network.rebuildLinkedGridPointSet(buildGridsForModes); // Cache the serialized network on the local filesystem and mirror it to any remote storage. - try { - File cacheLocation = FileUtils.createScratchFile(); - KryoNetworkSerializer.write(network, cacheLocation); - fileStorage.moveIntoStorage(getR5NetworkFileStorageKey(networkId), cacheLocation); - } catch (Exception e) { - // Tolerate exceptions here as we do have a network to return, we just failed to cache it. - LOG.error("Error saving cached network, returning the object anyway.", e); - } + File cacheLocation = FileUtils.createScratchFile(); + KryoNetworkSerializer.write(network, cacheLocation); + fileStorage.moveIntoStorage(getR5NetworkFileStorageKey(networkId), cacheLocation); + return network; }