Skip to content

Commit

Permalink
Missing error check
Browse files Browse the repository at this point in the history
  • Loading branch information
lxcode committed Nov 14, 2024
1 parent 5fb7f2c commit 93bfe82
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/hydrator/hydrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ func (h *Hydrator) LookupIdentity(identifier string) (identity *atpidentity.Iden

if found && cachedValue != nil {
if cachedError, isErr := cachedValue.(error); isErr {
log.Debugf("Cached error for %s: %v", identifier, cachedError)
return nil, cachedError // Return the cached error
}
log.Debugf("Cached error for %s: %v", identifier, cachedError)
return nil, cachedError // Return the cached error
}
identity = cachedValue.(*atpidentity.Identity)
return
}
Expand Down Expand Up @@ -168,6 +168,11 @@ func (h *Hydrator) lookupPost(atUrl string) (post *bsky.FeedDefs_PostView, err e
h.Ratelimit.Take()
output, err := bsky.FeedGetPosts(h.Context, h.Client, []string{atUrl})

if err != nil {
log.Errorf("Unable to fetch post at %s: %s", atUrl, err)
return
}

if len(output.Posts) == 0 {
err = fmt.Errorf("no posts found for %s", atUrl)
}
Expand Down

0 comments on commit 93bfe82

Please sign in to comment.