From 4152ed5eaa7e15e4198e8c37276990368074fe53 Mon Sep 17 00:00:00 2001 From: Eliot Whalan Date: Thu, 23 Jun 2016 14:00:27 +1000 Subject: [PATCH] fixup deletion handler more --- main.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 2b5d343..1e8bc32 100644 --- a/main.go +++ b/main.go @@ -119,10 +119,11 @@ func delHandler(w http.ResponseWriter, r *http.Request) { check(err) affect, err := res.RowsAffected() - check(err) - - io.WriteString(w, string(affect)) - + if err == sql.ErrNoRows { + io.WriteString(w, "Error invalid paste") + } else { + io.WriteString(w, paste+" deleted") + } db.Close() }