ecto_hooks
ecto_hooks copied to clipboard
Scope the rescue clause to only catch undefined ecto hooks functions.
I did this in the Web UI and haven't run it yet so I'm not sure if the implementation is 100% correct, but I wanted to capture the problem and general idea of a solution.
We should be able to add some unit tests that verify the behavior.
I don't think the exception pattern clauses can have real pattern matches in them.
I think we should definitely do this, but let's just do an if or case inside the exception handler clause like:
rescue
e in [UndefinedFunctionError, ...] ->
if e.function == ^hook do
:ok
else
reraise e, stacktrace: __STACKTRACE__
end