forked from FabianVowie/Lithium
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
345 B
17 lines
345 B
package controllers
|
|
|
|
import (
|
|
"encoding/json"
|
|
"github.com/sirupsen/logrus"
|
|
"net/http"
|
|
)
|
|
|
|
func writeError(w http.ResponseWriter, status int, errStr string) {
|
|
w.WriteHeader(status)
|
|
err := json.NewEncoder(w).Encode(struct {
|
|
Error string `json:"error"`
|
|
}{errStr})
|
|
if err != nil {
|
|
logrus.Fatal("Could not write JSON response: ", err)
|
|
}
|
|
}
|