@ -2,12 +2,16 @@ package controllers
import (
"encoding/json"
"github.com/sirupsen/logrus"
"net/http"
)
func writeError(w http.ResponseWriter, status int, errStr string) {
w.WriteHeader(status)
json.NewEncoder(w).Encode(struct {
err := json.NewEncoder(w).Encode(struct {
Error string `json:"error"`
}{errStr})
if err != nil {
logrus.Fatal("Could not write JSON response: ", err)
}