Skip to content

Commit

Permalink
Add help when docs download times out (#1057)
Browse files Browse the repository at this point in the history
Before this commit, if there was a timeout when download docs, an error
like this was printed:

```
$ mix hex.docs fetch elixir
Couldn't find docs for package with name elixir or version 1.18.0
``

With this commit, the error looks like this and the suggestion helped
me, at least:

```
$ mix hex.docs fetch elixir
Timed out trying to download docs. Try changing your timeout settings:

    HEX_HTTP_TIMEOUT=120 mix hex.docs fetch elixir 1.18.0

$ HEX_HTTP_TIMEOUT=120 mix hex.docs fetch elixir 1.18.0
Docs fetched: /Users/fhunleth/.hex/docs/hexpm/elixir/1.18.0
```
  • Loading branch information
fhunleth authored Dec 24, 2024
1 parent cc4d87a commit 96c8f54
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/mix/tasks/hex.docs.ex
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,17 @@ defmodule Mix.Tasks.Hex.Docs do
File.write!(target, body)
true

{:error, :timeout} ->
message = """
Timed out trying to download docs. Try changing your timeout settings:
HEX_HTTP_TIMEOUT=120 mix hex.docs fetch #{package} #{version}
"""

Hex.Shell.error(message)

false

_ ->
message = "Couldn't find docs for package with name #{package} or version #{version}"
Hex.Shell.error(message)
Expand Down

0 comments on commit 96c8f54

Please sign in to comment.