Skip to content

Commit

Permalink
chore: add descriptive error message upon attempting to access non-ex…
Browse files Browse the repository at this point in the history
…istent stop_id (#789)

* fix: allow nil stops through

* chore: change to descriptive exception
  • Loading branch information
nlwstein authored Apr 16, 2024
1 parent c93e717 commit 219bf58
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions apps/state/lib/state/shape.ex
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,14 @@ defmodule State.Shape do
into: MapSet.new() do
# use the parent station ID
case State.Stop.by_id(schedule.stop_id) do
%{id: id, parent_station: nil} -> id
%{parent_station: id} -> id
%{id: id, parent_station: nil} ->
id

%{parent_station: id} ->
id

nil ->
raise "schedule_stop_id=#{schedule.stop_id} Schedule stop_id is not present in Stop state."
end
end
end
Expand Down

0 comments on commit 219bf58

Please sign in to comment.