add error handler

This commit is contained in:
Данил 2022-09-19 02:06:28 +03:00
parent 01cdf12b54
commit 2e2b079fc4

View file

@ -11,5 +11,8 @@ func Message(status bool, message string) map[string]interface{} {
func Respond(w http.ResponseWriter, data map[string]interface{}) {
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
err := json.NewEncoder(w).Encode(data)
if err != nil {
panic(err)
}
}