diff --git a/internal/api/watcher.go b/internal/api/watcher.go index e37a0df..0aa8105 100644 --- a/internal/api/watcher.go +++ b/internal/api/watcher.go @@ -70,11 +70,15 @@ func (a *api) createWatcherHandler(w http.ResponseWriter, r *http.Request) { } accs, err := a.accountRepo.GetByAPNSToken(ctx, apns) - if err != nil || len(accs) == 0 { + if err != nil { a.errorResponse(w, r, 422, err.Error()) return } + if len(accs) == 0 { + a.errorResponse(w, r, 422, "can't create watchers without accounts") + } + account := accs[0] found := false for _, acc := range accs {