refactor(server/api): migrate auth/me handlers to writeErr(err) (T3a)
This commit is contained in:
+3
-1
@@ -2,8 +2,10 @@ package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/apierror"
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/auth"
|
||||
)
|
||||
|
||||
@@ -13,7 +15,7 @@ func (h *handlers) handleGetMe(w http.ResponseWriter, r *http.Request) {
|
||||
// Hitting /me without RequireUser in front of it is a routing bug;
|
||||
// it can't happen in real traffic.
|
||||
h.logger.Error("api: /me reached without authenticated user")
|
||||
writeErr(w, http.StatusInternalServerError, "server_error", "missing auth context")
|
||||
writeErr(w, apierror.InternalMsg("missing auth context", errors.New("missing auth context")))
|
||||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
Reference in New Issue
Block a user