Do not catch norows error
This commit is contained in:
parent
62f43d7eb3
commit
01fb1a2b7d
@ -51,9 +51,6 @@ func (db *Db) GetUser(id int) (*UserWithAllowance, error) {
|
|||||||
|
|
||||||
err := db.db.Query("select u.id, u.name, sum(h.amount) from users u join history h on h.user_id = u.id where u.id = ?").
|
err := db.db.Query("select u.id, u.name, sum(h.amount) from users u join history h on h.user_id = u.id where u.id = ?").
|
||||||
Bind(id).ScanSingle(&user.ID, &user.Name, &user.Allowance)
|
Bind(id).ScanSingle(&user.ID, &user.Name, &user.Allowance)
|
||||||
if errors.Is(err, mysqlite.ErrNoRows) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user