mod/user: add check for when usr is not found
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ce70bbe196
commit
faefe3b577
@ -53,6 +53,12 @@ func QueryUser(ctx context.Context, client *ent.Client, username string) (*ent.U
|
|||||||
// or more than 1 user returned.
|
// or more than 1 user returned.
|
||||||
Only(ctx)
|
Only(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Warn("error querying user", "error", err, "username requested", username)
|
||||||
|
|
||||||
|
if ent.IsNotFound(err) {
|
||||||
|
return nil, fmt.Errorf("user not found: %q", err)
|
||||||
|
}
|
||||||
|
|
||||||
return nil, fmt.Errorf("failed querying user: %w", err)
|
return nil, fmt.Errorf("failed querying user: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user