I have this function and the exception is being raised as expected. However, the block is still being evaluated even though the conditional returns false. What is happening here?
def authorize_role!(from, to, required_role, do: block) when required_role in @roles do
actual_role = role_for_schema!(from, to)
if role_index(actual_role) >= role_index(required_role) do
block
else
raise AuthorizationError
end
end