tzdata
tzdata copied to clipboard
Trying not to crash
It would be cool, when DataLoader.download_new would not crash on timeouts/etc.
A Logger.warn would be nicer, instead of getting a alarm from Sentry :(
https://github.com/lau/tzdata/blob/master/lib/tzdata/data_loader.ex#L10
Anybody willing to work on this?
That's probably because the url changed to https://data.iana.org/time-zones/releases/tzdata2017c.tar.gz- let me pr this quickly.
Thanks, but that is not exactly what i meant.
I had something like this in mind:
# instead of this what will crash unnecessarily
{:ok, 200, headers, client_ref} = :hackney.get(url, [], "", [follow_redirect: true])
# refactor the code like this:
case :hackney.get(url, [], "", [follow_redirect: true]) do
{:ok, 200, headers, client_ref} ->
# rest of code
error ->
Logger.warn("Fetching #{inspect url} failed because of error #{inspect error}")
error
end