securities: Allow SQL update count to be 0

MySQL reports 0 here, while sqlite reports 1. Improve the logged message
while we're at it.
This commit is contained in:
Aaron Lindsay 2017-10-24 20:24:12 -04:00
parent bcbb003e40
commit a1d294c309
1 changed files with 3 additions and 2 deletions

View File

@ -5,6 +5,7 @@ package handlers
import (
"encoding/json"
"errors"
"fmt"
"log"
"net/http"
"net/url"
@ -142,8 +143,8 @@ func UpdateSecurity(tx *Tx, s *Security) (err error) {
if err != nil {
return
}
if count != 1 {
return errors.New("Updated more than one security")
if count > 1 {
return fmt.Errorf("Updated %d securities (expected 1)", count)
}
return nil