1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2024-10-30 07:40:05 -04:00

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

View File

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