From 2e2b079fc474e80991f168773221d4b25f53138b Mon Sep 17 00:00:00 2001 From: Redume Date: Mon, 19 Sep 2022 02:06:28 +0300 Subject: [PATCH] add error handler --- api/utils/utils.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/utils/utils.go b/api/utils/utils.go index 5f51065..c903b44 100644 --- a/api/utils/utils.go +++ b/api/utils/utils.go @@ -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) + } }