Skip to content

ensure_compiled! issue when using Hammox.Protect #140

@boonious

Description

@boonious

When using use Hammox.Protect (and protect/2) with older versions of Elixir (< 1.12), the following error is raised because Code.ensure_compiled! isn't available in the check_module_exists util function.

** (UndefinedFunctionError) function Code.ensure_compiled!/1 is undefined or private. Did you mean one of:

      * ensure_compiled/1
      * ensure_loaded/1

    (elixir 1.11.4) Code.ensure_compiled!(Hui.ResponseParsers.Parser)
    lib/hammox/protect.ex:153: Hammox.Protect.get_funs!/1

A fix should be created in similar vein to Mox:
https://github.com/dashbitco/mox/blob/a59a1840676ceb0ef6c3e0f4959242ccb5d593ab/lib/mox.ex#L794-L809

Happy to submit a PR since Hammox is still elixir: "~> 1.7".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions