You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SwissSchema's all/1 should be returning lists wrapped in ok-tuples:
# Today, all/1 returns a raw list:User.all()# => [%User{}, %User{}, %User{}, ...]# It should, instead:User.all()# => {:ok, [%User{}, %User{}, %User{}, ...]}
The reason is simple: it's an IO op, which might fail due to reasons (network failure, db perms, schema mismatch, etc.). I know it differs from Ecto's default behavior, but I think we might improve the DX by standardizing the returned structure of this function.
Also, if Ecto's all/2 throws errors when things go wrong, we should be rescuing them to returning error-tupled values:
# Something is wrong – eg.: network is unavailableUser.all()# => {:error, %SomeError{}}
The text was updated successfully, but these errors were encountered:
SwissSchema's
all/1
should be returning lists wrapped in ok-tuples:The reason is simple: it's an IO op, which might fail due to reasons (network failure, db perms, schema mismatch, etc.). I know it differs from Ecto's default behavior, but I think we might improve the DX by standardizing the returned structure of this function.
Also, if Ecto's
all/2
throws errors when things go wrong, we should be rescuing them to returning error-tupled values:The text was updated successfully, but these errors were encountered: