Skip to content

Commit

Permalink
Resist to unescaped characters in gtfs
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitfred committed Jan 14, 2025
1 parent 6d2d36c commit e070530
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions apps/transport/lib/registry/gtfs.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,18 @@ defmodule Transport.Registry.GTFS do
{:ok, content} ->
Logger.debug("Valid Zip archive")

content
|> Utils.to_stream_of_maps()
|> Stream.flat_map(&handle_stop(data_source_id, &1))
|> Enum.to_list()
|> Result.ok()
try do
content
|> Utils.to_stream_of_maps()
|> Stream.flat_map(&handle_stop(data_source_id, &1))
|> Enum.to_list()
|> Result.ok()
rescue
e in NimbleCSV.ParseError ->
e
|> Exception.message()
|> Result.error()
end
end
end

Expand Down

0 comments on commit e070530

Please sign in to comment.