init
This commit is contained in:
commit
fa6a4c650f
93 files changed
+6555
No files matched your search
@@ -0,0 +1,23 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func WriteError(
|
||||
w http.ResponseWriter,
|
||||
code int,
|
||||
errCode string,
|
||||
msg string,
|
||||
) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(code)
|
||||
|
||||
_ = json.NewEncoder(w).Encode(map[string]any{
|
||||
"error": map[string]any{
|
||||
"code": errCode,
|
||||
"message": msg,
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user