diff --git a/main.go b/main.go index 053c7a9..b4b9ae1 100644 --- a/main.go +++ b/main.go @@ -44,9 +44,13 @@ func handleMicroPub(w http.ResponseWriter, r *http.Request) { } bodyString := string(bodyBytes) entry, err := CreateEntry(contentType, bodyString) - if entry == nil { + if err != nil || entry == nil { w.WriteHeader(http.StatusBadRequest) - _, _ = w.Write([]byte("There was an error creating the entry")) + if err != nil { + _, _ = w.Write([]byte(err.Error())) + } else { + _, _ = w.Write([]byte("There was an error creating the entry")) + } return } if CheckAuthorization(entry, r.Header.Get("authorization")) {