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 17cb3bb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/x509/logger.ex
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
defmodule X509.Logger do
@moduledoc false
alias X509.Util

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 17cb3bb

Please sign in to comment.