fix(http): change onboarding unavailable log level (#2048)

* fix(http): change onboarding unavailable log level

* fix(http): move omitting of warning further up

* feat: update log msg

---------

Co-authored-by: ze0s <43699394+zze0s@users.noreply.github.com>
This commit is contained in:
martylukyy 2025-04-27 17:55:09 +02:00 committed by GitHub
parent c7efcf1b75
commit 0c71f3a3d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -179,7 +179,7 @@ func (h authHandler) onboard(w http.ResponseWriter, r *http.Request) {
func (h authHandler) canOnboard(w http.ResponseWriter, r *http.Request) {
if status, err := h.onboardEligible(r.Context()); err != nil {
if status == http.StatusServiceUnavailable {
h.encoder.StatusWarning(w, status, err.Error())
h.encoder.StatusResponse(w, status, err.Error())
return
}
h.encoder.StatusError(w, status, err)
@ -199,7 +199,8 @@ func (h authHandler) onboardEligible(ctx context.Context) (int, error) {
}
if userCount > 0 {
return http.StatusServiceUnavailable, errors.New("onboarding unavailable")
h.log.Trace().Msg("onboarding unavailable: user already registered")
return http.StatusServiceUnavailable, errors.New("onboarding unavailable: user already registered")
}
return http.StatusOK, nil