Skip to content

Commit

Permalink
Work around compilation warning on OTP 25 or older
Browse files Browse the repository at this point in the history
  • Loading branch information
g-andrade committed Oct 14, 2023
1 parent c5bdd25 commit 90779c4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/sqids/agent.ex
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,13 @@ defmodule Sqids.Agent do
# Use proc_lib:init_fail/2 instead of {:stop, reason} to avoid
# polluting the logs: our supervisor will fail to start us and this
# will already produce log messages with the relevant info.
:proc_lib.init_fail(error, {:exit, :normal})

# Use apply/3 to avoid compilation warnings on OTP 25 or older.
# credo:disable-for-next-line Credo.Check.Refactor.Apply
apply(:proc_lib, :init_fail, [error, {:exit, :normal}])
catch
:error, :undef ->
# Fallback for pre- OTP 26
# Fallback for OTP 25 or older
server_name = server_name(sqids_module)
Process.unregister(server_name)
:proc_lib.init_ack(error)
Expand Down

0 comments on commit 90779c4

Please sign in to comment.