all repos — honk @ cf2a581cdc7d90e1bda06095ad7efa1981269780

my fork of honk

every database exec must have error checking
Ted Unangst tedu@tedunangst.com
Fri, 16 Aug 2019 00:15:55 -0400
commit

cf2a581cdc7d90e1bda06095ad7efa1981269780

parent

0c94d295a84efc76854b820b0e5313890872e8b9

3 files changed, 31 insertions(+), 9 deletions(-)

jump to
M activity.goactivity.go

@@ -230,13 +230,19 @@ if x.What == "eradicate" {

log.Printf("eradicating %s by %s", x.XID, x.Honker) xonk := getxonk(user.ID, x.XID) if xonk != nil { - stmtZonkDonks.Exec(xonk.ID) - _, err := stmtZonkIt.Exec(user.ID, x.XID) + _, err := stmtZonkDonks.Exec(xonk.ID) + if err != nil { + log.Printf("error eradicating: %s", err) + } + _, err = stmtZonkIt.Exec(user.ID, x.XID) if err != nil { log.Printf("error eradicating: %s", err) } } - stmtSaveZonker.Exec(user.ID, x.XID, "zonk") + _, err := stmtSaveZonker.Exec(user.ID, x.XID, "zonk") + if err != nil { + log.Printf("error eradicating: %s", err) + } return } log.Printf("saving xonk: %s", x.XID)

@@ -966,7 +972,10 @@ href, _ := l.GetString("href")

rel, _ := l.GetString("rel") t, _ := l.GetString("type") if rel == "self" && friendorfoe(t) { - stmtSaveXonker.Exec(name, href, "fishname") + _, err := stmtSaveXonker.Exec(name, href, "fishname") + if err != nil { + log.Printf("error saving fishname: %s", err) + } handlock.Lock() handfull[name] = href handlock.Unlock()
M deliverator.godeliverator.go

@@ -50,7 +50,10 @@ return

} drift += time.Duration(notrand.Int63n(int64(drift / 10))) when := time.Now().UTC().Add(drift) - stmtAddDoover.Exec(when.Format(dbtimeformat), goarounds, username, rcpt, msg) + _, err := stmtAddDoover.Exec(when.Format(dbtimeformat), goarounds, username, rcpt, msg) + if err != nil { + log.Printf("error saving doover: %s", err) + } select { case pokechan <- 0: default:

@@ -150,7 +153,11 @@ if err != nil {

log.Printf("error scanning doover: %s", err) continue } - stmtZapDoover.Exec(d.ID) + _, err = stmtZapDoover.Exec(d.ID) + if err != nil { + log.Printf("error deleting doover: %s", err) + continue + } log.Printf("redeliverating %s try %d", rcpt, goarounds) deliverate(goarounds, username, rcpt, msg) } else if d.When.Before(nexttime) {
M honk.gohonk.go

@@ -479,7 +479,7 @@ var honkers []Honker

for rows.Next() { var xid string rows.Scan(&xid) - honkers = append(honkers, Honker{ XID: xid}) + honkers = append(honkers, Honker{XID: xid}) } rows.Close() for i, _ := range honkers {

@@ -927,8 +927,14 @@ userinfo := login.GetUserInfo(r)

if wherefore == "zonk" { xonk := getxonk(userinfo.UserID, what) if xonk != nil { - stmtZonkDonks.Exec(xonk.ID) - stmtZonkIt.Exec(userinfo.UserID, what) + _, err := stmtZonkDonks.Exec(xonk.ID) + if err != nil { + log.Printf("error zonking: %s", err) + } + _, err = stmtZonkIt.Exec(userinfo.UserID, what) + if err != nil { + log.Printf("error zonking: %s", err) + } if xonk.Whofore == 2 || xonk.Whofore == 3 { zonk := Honk{ What: "zonk",