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

fix: handle when auto updater receives a non-200 from GitHub API #351

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/next_ls/updater.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defmodule NextLS.Updater do
retry = Keyword.get(opts, :retry, :safe)

case Req.get("/repos/elixir-tools/next-ls/releases/latest", base_url: api_host, retry: retry) do
{:ok, %{body: %{"tag_name" => "v" <> version = tag}}} ->
{:ok, %{status: 200, body: %{"tag_name" => "v" <> version = tag}}} ->
with {:ok, latest_version} <- Version.parse(version),
:gt <- Version.compare(latest_version, current_version) do
with :ok <- File.rename(binpath, binpath <> "-#{Version.to_string(current_version)}"),
Expand Down Expand Up @@ -65,7 +65,7 @@ defmodule NextLS.Updater do
end
end

{:error, error} ->
{_, error} ->
NextLS.Logger.error(
logger,
"Failed to retrieve the latest version number of Next LS from the GitHub API: #{inspect(error)}"
Expand Down
Loading