aboutsummaryrefslogtreecommitdiff
path: root/backend/api
diff options
context:
space:
mode:
authorjackyzha0 <[email protected]>2020-05-11 21:43:15 -0700
committerjackyzha0 <[email protected]>2020-05-11 21:43:15 -0700
commit021b8cd46b1fa70a8da2fc867412bb65afd42722 (patch)
tree398966c0aa9bdfadb4285b62e0ce1aede213d396 /backend/api
parenterror print (diff)
downloadctrl-v-021b8cd46b1fa70a8da2fc867412bb65afd42722.tar.xz
ctrl-v-021b8cd46b1fa70a8da2fc867412bb65afd42722.zip
add err messages
Diffstat (limited to 'backend/api')
-rw-r--r--backend/api/routes.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/backend/api/routes.go b/backend/api/routes.go
index f8d2e4f..ff43714 100644
--- a/backend/api/routes.go
+++ b/backend/api/routes.go
@@ -38,7 +38,8 @@ func insertFunc(w http.ResponseWriter, r *http.Request) {
hash, err := db.New(ip, content, expiry, title, password)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
- fmt.Fprintf(w, "got err: %s", err.Error())
+ fmt.Fprintf(w, "%s", err.Error())
+ return
}
// if successful return paste hash
@@ -75,14 +76,14 @@ func handleGetPaste(w http.ResponseWriter, r *http.Request, parsedPassword strin
// if hash was not found
if err == cache.PasteNotFound {
w.WriteHeader(http.StatusNotFound)
- fmt.Fprintf(w, "got err: %s", err)
+ fmt.Fprintf(w, "%s", err)
return
}
// if paste is password protected
if err == cache.UserUnauthorized {
w.WriteHeader(http.StatusUnauthorized)
- fmt.Fprintf(w, "got err: %s", err)
+ fmt.Fprintf(w, "%s", err)
return
}