dont marshal uninitialized players
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"local/router"
|
||||
"local/storage"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -109,6 +110,9 @@ func badRequest(w http.ResponseWriter, message string) {
|
||||
}
|
||||
|
||||
func errHandler(w http.ResponseWriter, status int, message string) {
|
||||
if message == storage.ErrNotFound.Error() {
|
||||
status = http.StatusNotFound
|
||||
}
|
||||
w.WriteHeader(status)
|
||||
json.NewEncoder(w).Encode(map[string]interface{}{
|
||||
"status": http.StatusText(status),
|
||||
|
||||
Reference in New Issue
Block a user