TIL how to make deprecation warnings:
Compiling 2 files (.ex)
warning: `Retort.Resources.timeout/2` is deprecated; call `Retort.Resources.Timeout.get_or_default/2` instead.
lib/retort/resources.ex:197: Retort.Resources.timeout/2
Replace function
@spec timeout(module) :: Keyword.t | timeout
defp timeout(module) do
:retort
|> Application.get_env(module, [])
|> Keyword.get(:timeout, @default_timeout)
end
With (undocumented) macro that replaces the call
@doc false
@spec timeout(module, Retort.Resources.Timeout.function_name) :: timeout
defmacro timeout(module, function_name) do
IO.warn "`Retort.Resources.timeout/2` is deprecated; call `Retort.Resources.Timeout.get_or_default/2` instead.",
Macro.Env.stacktrace(__ENV__)
quote do
Retort.Resources.Timeout.get_or_default(unquote(module), unquote(function_name))
end
end