improved error handling in DoesTorrentExist() in persistence/sqlite3.go
This commit is contained in:
parent
ddd0b15b69
commit
7048110cd0
@ -58,6 +58,9 @@ func (db *sqlite3Database) DoesTorrentExist(infoHash []byte) (bool, error) {
|
|||||||
// If rows.Next() returns true, meaning that the torrent is in the database, return true; else
|
// If rows.Next() returns true, meaning that the torrent is in the database, return true; else
|
||||||
// return false.
|
// return false.
|
||||||
exists := rows.Next()
|
exists := rows.Next()
|
||||||
|
if !exists && rows.Err() != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
if err = rows.Close(); err != nil {
|
if err = rows.Close(); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
|
Loading…
Reference in New Issue
Block a user