honeybadger-elixir icon indicating copy to clipboard operation
honeybadger-elixir copied to clipboard

Regex in constants not supported in OTP 28

Open tjchambers opened this issue 5 months ago • 0 comments

Elixir 1.9-rc.0 OTP 28 Honeybadger 0.24

== Compilation error in file lib/honeybadger/insights/ecto.ex ==
** (ArgumentError) cannot inject attribute @excluded_queries into function/macro because ~r/^(begin|commit)( immediate)?( transaction)?$/i contains a reference (#Reference<0.2837158583.796262404.153084>) and therefore it cannot be escaped (it must be defined within a function instead). The supported values are: lists, tuples, maps, atoms, numbers, bitstrings, PIDs and remote functions in the format &Mod.fun/arity
    (elixir 1.19.0-rc.0) lib/kernel.ex:3878: Kernel.do_at_escape/2
    (elixir 1.19.0-rc.0) expanding macro: Kernel.@/1
    lib/honeybadger/insights/ecto.ex:146: Honeybadger.Insights.Ecto.ignore?/1
    (elixir 1.19.0-rc.0) expanding macro: Kernel.|>/2
    lib/honeybadger/insights/ecto.ex:146: Honeybadger.Insights.Ecto.ignore?/1
    (elixir 1.19.0-rc.0) expanding macro: Kernel.|>/2
    lib/honeybadger/insights/ecto.ex:147: Honeybadger.Insights.Ecto.ignore?/1
    (elixir 1.19.0-rc.0) expanding macro: Kernel.if/2
could not compile dependency :honeybadger, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile honeybadger --force", update it with "mix deps.update honeybadger" or clean it with "mix deps.clean honeybadger"

OTP 28 does not allow regex formats in module constants. There are numerous examples of how to fix this, but it will be important to correct as using a function in place of the constant is more appropriate.

Here is an example of a similar resolution: https://github.com/nurugger07/inflex/pull/99/files

tjchambers avatar Jun 12 '25 21:06 tjchambers