PrePlug v1.0.0 PrePlug
This module is gross, but it’s my current solution to the issue being tracked
inside https://github.com/elixir-lang/plug/issues/409. Basically, we need a
way to make sure that certain plugs are executed before the execution of the
try
context inside Plug.ErrorHandler
. We do this by simply overriding the
call/2
function and passing the executed plugs to the super
.
It should be noted that you must use PrePlug
after
importing any other functions which override call/2
. This is because the
overrides in this module would become pointless if overridden.
Summary
Macros
A macro which ensures PrePlug is loaded into the current module
A macro that stores a new pre-plug. opts
will be passed unchanged to the new
plug
Macros
A macro which ensures PrePlug is loaded into the current module.
If PrePlug has already been included via use
, this will do nothing.
A macro that stores a new pre-plug. opts
will be passed unchanged to the new
plug.
This macro doesn’t add any guards when adding the new plug to the pipeline;
for more information about adding plugs with guards see Plug.Builder.compile/1
.
Examples
pre_plug Plug.Logger # pre_plug module
pre_plug :foo, some_options: true # pre_plug function