mirror of
https://github.com/ent/ent.git
synced 2026-05-28 09:49:08 +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
@@ -46,7 +46,7 @@ func ({{ $receiver }} *{{ $builder }}) sqlSave(ctx context.Context) ({{ $ret }}
|
||||
{{- if $one }}
|
||||
switch n := len(ids); {
|
||||
case n == 0:
|
||||
return {{ $zero }}, fmt.Errorf("{{ $pkg }}: {{ $.Name }} not found with id: %v", {{ $receiver }}.id)
|
||||
return {{ $zero }}, &ErrNotFound{fmt.Sprintf("{{ $.Name }} with id: %v", {{ $receiver }}.id)}
|
||||
case n > 1:
|
||||
return {{ $zero }}, fmt.Errorf("{{ $pkg }}: more than one {{ $.Name }} with the same id: %v", {{ $receiver }}.id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user