fix bugsnag exception

This commit is contained in:
Andre Medeiros 2022-05-07 13:38:04 -04:00
parent 5e2a846bc1
commit eaf6a707ca

View file

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