Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying not to crash #50

Open
h4cc opened this issue Nov 22, 2017 · 2 comments
Open

Trying not to crash #50

h4cc opened this issue Nov 22, 2017 · 2 comments

Comments

@h4cc
Copy link

h4cc commented Nov 22, 2017

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?

@madsheep
Copy link
Contributor

That's probably because the url changed to https://data.iana.org/time-zones/releases/tzdata2017c.tar.gz- let me pr this quickly.

@h4cc
Copy link
Author

h4cc commented Nov 25, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants