all repos — honk @ 47cd70806cb551c6e73b12d68932be65ed56f6ca

my fork of honk

more info about some errors
Ted Unangst tedu@tedunangst.com
Fri, 30 Aug 2019 10:16:59 -0400
commit

47cd70806cb551c6e73b12d68932be65ed56f6ca

parent

648a58494ee3347fd84c9202cd9d790a10ba5f38

3 files changed, 12 insertions(+), 11 deletions(-)

jump to
M activity.goactivity.go

@@ -1060,28 +1060,28 @@ }

return true } -func investigate(name string) *Honker { +func investigate(name string) (*Honker, error) { if name == "" { - return nil + return nil, fmt.Errorf("no name") } if name[0] == '@' { name = gofish(name) } if name == "" { - return nil + return nil, fmt.Errorf("no name") } log.Printf("digging up some info on %s", name) obj, err := GetJunkFast(name) if err != nil { log.Printf("error investigating honker: %s", err) - return nil + return nil, err } t, _ := obj.GetString("type") if !isactor(t) { log.Printf("it's not a person! %s", name) - return nil + return nil, err } xid, _ := obj.GetString("id") handle, _ := obj.GetString("preferredUsername") - return &Honker{XID: xid, Handle: handle} + return &Honker{XID: xid, Handle: handle}, nil }
M fun.gofun.go

@@ -419,7 +419,7 @@ row := stmtGetXonker.QueryRow(xid, "handle")

var handle string err := row.Scan(&handle) if err != nil { - p := investigate(xid) + p, _ := investigate(xid) if p == nil { m := re_unurl.FindStringSubmatch(xid) if len(m) > 2 {
M honk.gohonk.go

@@ -480,7 +480,7 @@ }

func ximport(w http.ResponseWriter, r *http.Request) { xid := r.FormValue("xid") - p := investigate(xid) + p, _ := investigate(xid) if p != nil { xid = p.XID }

@@ -1426,8 +1426,9 @@ flavor := "presub"

if peep == "peep" { flavor = "peep" } - p := investigate(url) - if p == nil { + p, err := investigate(url) + if err != nil { + http.Error(w, "error investigating: "+err.Error(), http.StatusInternalServerError) log.Printf("failed to investigate honker") return }

@@ -1435,7 +1436,7 @@ url = p.XID

if name == "" { name = p.Handle } - _, err := stmtSaveHonker.Exec(u.UserID, name, url, flavor, combos) + _, err = stmtSaveHonker.Exec(u.UserID, name, url, flavor, combos) if err != nil { log.Print(err) return