Return error message when creating entry failed
parent
7c07e4fdd9
commit
eb81344036
6
main.go
6
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)
|
||||
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")) {
|
||||
|
|
Loading…
Reference in New Issue