Skip to content

Commit

Permalink
mark journeys where reconstruction failed with error_ = true
Browse files Browse the repository at this point in the history
  • Loading branch information
pablohoch committed Aug 14, 2024
1 parent aeb71bf commit 5df1809
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions include/nigiri/routing/journey.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ struct journey {
unixtime_t dest_time_;
location_idx_t dest_;
std::uint8_t transfers_{0U};
bool error_{false};
};

} // namespace nigiri::routing
9 changes: 8 additions & 1 deletion include/nigiri/routing/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "utl/timing.h"
#include "utl/to_vec.h"

#include "nigiri/logging.h"
#include "nigiri/routing/dijkstra.h"
#include "nigiri/routing/for_each_meta.h"
#include "nigiri/routing/get_fastest_direct.h"
Expand Down Expand Up @@ -385,7 +386,13 @@ struct search {
if (j.legs_.empty() &&
(is_ontrip() || search_interval_.contains(j.start_time_)) &&
j.travel_time() < fastest_direct_) {
algo_.reconstruct(q_, j);
try {
algo_.reconstruct(q_, j);
} catch (std::exception const& e) {
j.error_ = true;
log(log_lvl::error, "search", "reconstruct failed: {}",
e.what());
}
}
}
});
Expand Down
9 changes: 5 additions & 4 deletions src/routing/raptor/reconstruct.cc
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,9 @@ void reconstruct_journey_with_vias(timetable const& tt,
}

throw utl::fail(
"intermodal destination reconstruction failed at k={}, t={}, "
"intermodal destination reconstruction failed at k={}, t={}, v={}, "
"stop={}, time={}",
k, j.transfers_, location{tt, l}, curr_time);
k, j.transfers_, v, location{tt, l}, curr_time);
}

trace_reconstruct("CHECKING TRANSFER AT {}\n", location{tt, l});
Expand All @@ -529,8 +529,9 @@ void reconstruct_journey_with_vias(timetable const& tt,
}
}

throw utl::fail("reconstruction failed at k={}, t={}, stop={}, time={}", k,
j.transfers_, location{tt, l}, curr_time);
throw utl::fail(
"reconstruction failed at k={}, t={}, v={}, stop={}, time={}", k,
j.transfers_, v, location{tt, l}, curr_time);
};

auto l = j.dest_;
Expand Down

0 comments on commit 5df1809

Please sign in to comment.