Dialyzer complains about this below:
lib/my_app/accounts/accounts.ex:134: Function authenticate_by_username_password/2 has no local return
def authenticate_by_username_password(username, given_password) do
user = User
|> Repo.get_by(username: username)
user && checkpw(given_password, user.credential.password_hash) ->
As mentioned in the doc If the struct in the queryable has no or more than one primary key, it will raise an argument error.
Moreover, the return value of get_by/3 could be :
Does that mean that if an argument error is raised by get_by/3, then the cond block won't be executed, moreover authenticate_by_username_password/2 return value will be set to type no_return(), which finally makes dialyzer complain like that?
If so, should I try to catch the possible argument error of get_by/3? Or just let it go .