From a1d294c309bb0113ce3fa85978c76ccd1de83549 Mon Sep 17 00:00:00 2001 From: Aaron Lindsay Date: Tue, 24 Oct 2017 20:24:12 -0400 Subject: [PATCH] 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. --- internal/handlers/securities.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/handlers/securities.go b/internal/handlers/securities.go index 9d047d3..1944a47 100644 --- a/internal/handlers/securities.go +++ b/internal/handlers/securities.go @@ -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