mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc: return ErrNotFound on UpdateOne
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/52 Reviewed By: alexsn Differential Revision: D17737477 fbshipit-source-id: 13890619e0af28a28e3d7bd50d7e4287599eeaf0
This commit is contained in:
committed by
Facebook Github Bot
parent
8b9e5cd7d0
commit
8e66691db5
@@ -256,7 +256,7 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) {
|
||||
}
|
||||
switch n := len(ids); {
|
||||
case n == 0:
|
||||
return nil, fmt.Errorf("ent: Pet not found with id: %v", puo.id)
|
||||
return nil, &ErrNotFound{fmt.Sprintf("Pet with id: %v", puo.id)}
|
||||
case n > 1:
|
||||
return nil, fmt.Errorf("ent: more than one Pet with the same id: %v", puo.id)
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) {
|
||||
}
|
||||
switch n := len(ids); {
|
||||
case n == 0:
|
||||
return nil, fmt.Errorf("ent: User not found with id: %v", uuo.id)
|
||||
return nil, &ErrNotFound{fmt.Sprintf("User with id: %v", uuo.id)}
|
||||
case n > 1:
|
||||
return nil, fmt.Errorf("ent: more than one User with the same id: %v", uuo.id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user