I don’t understand why “Any” fallbacks don’t work in this case. Here is the story:
I am using Timex library for my models in a phoenix project.
$iex -S mix
# This works
iex()> Timex.is_valid?({2016, 01, 01})
true
# This should be false
iex()> Timex.is_valid?("caturday")
** (Protocol.UndefinedError) protocol Timex.Protocol not implemented for "caturday"
(timex) lib/protocol.ex:1: Timex.Protocol.impl_for!/1
(timex) lib/protocol.ex:150: Timex.Protocol.is_valid?/1
Looking at the code for Timex.is_valid? it delegates to Timex.Protocol where the catch All version returns a tuple {:error, :invalid_date}.
So why in the above example I get an exception instead of the tuple?
Edit: I even added a line in my local copy of deps/timex/lib/protocol.ex
@fallback_to_any true
and recompiled but still doesn’t work






















