Skip to content

Commit

Permalink
Fix credo warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
fhunleth committed Jul 24, 2020
1 parent 9bb0a52 commit 1e477d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 3 additions & 1 deletion lib/vintage_net/info.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
defmodule VintageNet.Info do
@moduledoc false

alias VintageNet.PowerManager.PMControl

@doc """
Print the current network status
"""
Expand Down Expand Up @@ -161,7 +163,7 @@ defmodule VintageNet.Info do
end

defp format_power_management(ifname) do
case VintageNet.PowerManager.PMControl.info(ifname) do
case PMControl.info(ifname) do
{:ok, info} ->
[" Power: ", info.pm_info, "\n"]

Expand Down
20 changes: 9 additions & 11 deletions lib/vintage_net/power_manager/pm_control.ex
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,15 @@ defmodule VintageNet.PowerManager.PMControl do
end

defp run_callback(state, callback, args) do
try do
apply(state.impl, callback, args)
catch
kind, reason ->
Logger.error([
log_prefix(state),
"callback #{callback} raised #{inspect(kind)}, #{inspect(reason)}. Exiting"
])

exit(:callback_failed)
end
apply(state.impl, callback, args)
catch
kind, reason ->
Logger.error([
log_prefix(state),
"callback #{callback} raised #{inspect(kind)}, #{inspect(reason)}. Exiting"
])

exit(:callback_failed)
end

defp start_timer(state, millis) do
Expand Down

0 comments on commit 1e477d8

Please sign in to comment.