Skip to content

Commit

Permalink
Fix version check for Elixir
Browse files Browse the repository at this point in the history
Prior to this patch, we couldn't use this package because it was
crashing when using Elixir pre-releases (here, 1.18.0-dev):

    == Compilation error in file lib/x509/logger.ex ==
    ** (ArgumentError) errors were found at the given arguments:

      * 1st argument: not a textual representation of an integer

        :erlang.binary_to_integer("0-dev")
        (elixir 1.18.0-dev) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
        (elixir 1.18.0-dev) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
        lib/x509/logger.ex:7: (module)

This is now fixed. `X509.Util.app_version/1` is still used in a couple
other places but just for applications that ship with OTP and they
should not have this problem.
  • Loading branch information
wojtekmach committed Jun 27, 2024
1 parent ea269fa commit 8336a5c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/x509/logger.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule X509.Logger do

require Logger

if Util.app_version(:logger) >= [1, 11, 0] do
if Version.match?(System.version(), ">= 1.11.0") do
def warn(message, metadata \\ []) do
Logger.warning(message, metadata)
end
Expand Down

0 comments on commit 8336a5c

Please sign in to comment.