Move httpError to common.go

This commit is contained in:
maru committed 2024-04-24 20:23:20 -04:00
1 parent fa5dcb0052
commit 7e3ba249df
2 files changed
+6 -6

No files matched your search

+6
View File
@@ -3,6 +3,7 @@ package api
import (
"encoding/base64"
"fmt"
"log"
"net/http"
"github.com/pagefaultgames/pokerogue-server/api/account"
@@ -81,3 +82,8 @@ func getUUIDFromRequest(r *http.Request) ([]byte, error) {
return uuid, nil
}
func httpError(w http.ResponseWriter, r *http.Request, err error, code int) {
log.Printf("%s: %s\n", r.URL.Path, err)
http.Error(w, err.Error(), code)
}
-6
View File
@@ -4,7 +4,6 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"log"
"net/http"
"strconv"
@@ -21,11 +20,6 @@ import (
Handlers should not return serialized JSON, instead return the struct itself.
*/
func httpError(w http.ResponseWriter, r *http.Request, err error, code int) {
log.Printf("%s: %s\n", r.URL.Path, err)
http.Error(w, err.Error(), code)
}
// account
func handleAccountInfo(w http.ResponseWriter, r *http.Request) {