Skip to content

Commit

Permalink
Remove error handling for IO.binwrite
Browse files Browse the repository at this point in the history
Currently, the write_config_file/1 function in the installer checks
the return value of a call to IO.binwrite/2. However, that function
only ever returns :ok or raises an error when it fails to write.

This patch removes the error handling, assuming the write works. Since
the error handling is removed, the write will crash the installer if
it fails, which is the intended bahavior.
  • Loading branch information
jeffkreeftmeijer committed Jun 25, 2024
1 parent d94d841 commit f9e5003
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions lib/mix/tasks/appsignal.install.ex
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,7 @@ defmodule Mix.Tasks.Appsignal.Install do

case File.open(appsignal_config_file_path(), [:write]) do
{:ok, file} ->
case IO.binwrite(file, appsignal_config_file_contents(config)) do
:ok ->
IO.puts("Success!")

{:error, reason} ->
IO.puts("Failure! #{inspect(reason)}")
exit(:shutdown)
end

IO.binwrite(file, appsignal_config_file_contents(config))
File.close(file)

{:error, reason} ->
Expand Down

0 comments on commit f9e5003

Please sign in to comment.