From eaf6a707cae586df041318ce8baca4055e726b61 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Sat, 7 May 2022 13:38:04 -0400 Subject: [PATCH] fix bugsnag exception --- internal/api/watcher.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 {